Struct web_audio_api::context::BaseAudioContext
source ·
[−]pub struct BaseAudioContext { /* private fields */ }
Expand description
The BaseAudioContext
interface represents an audio-processing graph built from audio modules
linked together, each represented by an AudioNode
. An audio context controls both the creation
of the nodes it contains and the execution of the audio processing, or decoding.
Implementations
The sample rate (in sample-frames per second) at which the AudioContext
handles audio.
The raw sample rate of the AudioContext
(which has more precision than the float
sample_rate()
value).
This is the time in seconds of the sample frame immediately following the last sample-frame in the block of audio most recently processed by the context’s rendering graph.
pub fn register<T: AudioNode, F: FnOnce(AudioContextRegistration) -> (T, Box<dyn AudioProcessor>)>(
&self,
f: F
) -> T
pub fn register<T: AudioNode, F: FnOnce(AudioContextRegistration) -> (T, Box<dyn AudioProcessor>)>(
&self,
f: F
) -> T
Construct a new pair of node::AudioNode
and AudioProcessor
The AudioNode
lives in the user-facing control thread. The Processor is sent to the render thread.
Trait Implementations
retrieves the BaseAudioContext
associated with the concrete AudioContext
fn decode_audio_data<R: Read + Send + 'static>(
&self,
input: R
) -> Result<AudioBuffer, Box<dyn Error + Send + Sync>>
fn decode_audio_data<R: Read + Send + 'static>(
&self,
input: R
) -> Result<AudioBuffer, Box<dyn Error + Send + Sync>>
Decode an AudioBuffer
from a given input stream. Read more
fn create_buffer(
&self,
number_of_channels: usize,
length: usize,
sample_rate: SampleRate
) -> AudioBuffer
fn create_buffer(
&self,
number_of_channels: usize,
length: usize,
sample_rate: SampleRate
) -> AudioBuffer
Create an new “in-memory” AudioBuffer
with the given number of channels,
length (i.e. number of samples per channel) and sample rate. Read more
Creates an OscillatorNode
, a source representing a periodic waveform. It basically
generates a tone. Read more
Creates an StereoPannerNode
to pan a stereo output
Creates an GainNode
, to control audio volume
Creates an ConstantSourceNode
, a source representing a constant value
Creates an IirFilterNode
Read more
Creates a DelayNode
, delaying the audio signal
Creates an BiquadFilterNode
which implements a second order filter
Creates a WaveShaperNode
Creates a ChannelSplitterNode
Creates a ChannelMergerNode
Creates a MediaStreamAudioSourceNode
from a MediaElement
Creates a MediaElementAudioSourceNode
from a MediaElement
Read more
Creates an AudioBufferSourceNode
Read more
Creates a PannerNode
Creates a AnalyserNode
Creates a periodic wave
fn create_audio_param(
&self,
opts: AudioParamOptions,
dest: &AudioNodeId
) -> (AudioParam, AudioParamId)
fn create_audio_param(
&self,
opts: AudioParamOptions,
dest: &AudioNodeId
) -> (AudioParam, AudioParamId)
Create an AudioParam
. Read more
Returns an AudioDestinationNode
representing the final destination of all audio in the
context. It can be thought of as the audio-rendering device. Read more
Returns the AudioListener
which is used for 3D spatialization
The sample rate (in sample-frames per second) at which the AudioContext
handles audio.
The raw sample rate of the AudioContext
(which has more precision than the float
sample_rate()
value). Read more
This is the time in seconds of the sample frame immediately following the last sample-frame in the block of audio most recently processed by the context’s rendering graph. Read more
Auto Trait Implementations
impl RefUnwindSafe for BaseAudioContext
impl Send for BaseAudioContext
impl Sync for BaseAudioContext
impl Unpin for BaseAudioContext
impl UnwindSafe for BaseAudioContext
Blanket Implementations
Mutably borrows from an owned value. Read more