Struct web_audio_api::context::ConcreteBaseAudioContext
source · [−]pub struct ConcreteBaseAudioContext { /* private fields */ }
Expand description
The struct that corresponds to the Javascript BaseAudioContext
object.
Please note that in rust, we need to differentiate between the BaseAudioContext
trait and
the ConcreteBaseAudioContext
concrete implementation.
This object is returned from the base()
method on AudioContext
and
OfflineAudioContext
, or the context()
method on AudioNode
s.
The ConcreteBaseAudioContext
allows for cheap cloning (using an Arc
internally).
Implementations
sourceimpl ConcreteBaseAudioContext
impl ConcreteBaseAudioContext
sourcepub fn sample_rate(&self) -> f32
pub fn sample_rate(&self) -> f32
The sample rate (in sample-frames per second) at which the AudioContext
handles audio.
sourcepub fn sample_rate_raw(&self) -> SampleRate
pub fn sample_rate_raw(&self) -> SampleRate
The raw sample rate of the AudioContext
(which has more precision than the float
sample_rate()
value).
sourcepub fn current_time(&self) -> f64
pub fn current_time(&self) -> f64
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.
sourcepub 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
sourceimpl BaseAudioContext for ConcreteBaseAudioContext
impl BaseAudioContext for ConcreteBaseAudioContext
sourcefn base(&self) -> &ConcreteBaseAudioContext
fn base(&self) -> &ConcreteBaseAudioContext
retrieves the ConcreteBaseAudioContext
associated with this AudioContext
sourcefn decode_audio_data_sync<R: Read + Send + Sync + 'static>(
&self,
input: R
) -> Result<AudioBuffer, Box<dyn Error + Send + Sync>>
fn decode_audio_data_sync<R: Read + Send + Sync + 'static>(
&self,
input: R
) -> Result<AudioBuffer, Box<dyn Error + Send + Sync>>
Decode an AudioBuffer
from a given input stream. Read more
sourcefn 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
sourcefn create_analyser(&self) -> AnalyserNode
fn create_analyser(&self) -> AnalyserNode
Creates a AnalyserNode
sourcefn create_biquad_filter(&self) -> BiquadFilterNode
fn create_biquad_filter(&self) -> BiquadFilterNode
Creates an BiquadFilterNode
which implements a second order filter
sourcefn create_buffer_source(&self) -> AudioBufferSourceNode
fn create_buffer_source(&self) -> AudioBufferSourceNode
Creates an AudioBufferSourceNode
sourcefn create_constant_source(&self) -> ConstantSourceNode
fn create_constant_source(&self) -> ConstantSourceNode
Creates an ConstantSourceNode
, a source representing a constant value
sourcefn create_channel_merger(&self, number_of_inputs: u32) -> ChannelMergerNode
fn create_channel_merger(&self, number_of_inputs: u32) -> ChannelMergerNode
Creates a ChannelMergerNode
sourcefn create_channel_splitter(&self, number_of_outputs: u32) -> ChannelSplitterNode
fn create_channel_splitter(&self, number_of_outputs: u32) -> ChannelSplitterNode
Creates a ChannelSplitterNode
sourcefn create_delay(&self, max_delay_time: f64) -> DelayNode
fn create_delay(&self, max_delay_time: f64) -> DelayNode
Creates a DelayNode
, delaying the audio signal
sourcefn create_gain(&self) -> GainNode
fn create_gain(&self) -> GainNode
Creates an GainNode
, to control audio volume
sourcefn create_iir_filter(
&self,
feedforward: Vec<f64>,
feedback: Vec<f64>
) -> IIRFilterNode
fn create_iir_filter(
&self,
feedforward: Vec<f64>,
feedback: Vec<f64>
) -> IIRFilterNode
Creates an IirFilterNode
Read more
sourcefn create_media_stream_source<M: MediaStream>(
&self,
media: M
) -> MediaStreamAudioSourceNode
fn create_media_stream_source<M: MediaStream>(
&self,
media: M
) -> MediaStreamAudioSourceNode
Creates a MediaStreamAudioSourceNode
from a MediaStream
sourcefn create_media_stream_destination(&self) -> MediaStreamAudioDestinationNode
fn create_media_stream_destination(&self) -> MediaStreamAudioDestinationNode
Creates a MediaStreamAudioDestinationNode
sourcefn create_oscillator(&self) -> OscillatorNode
fn create_oscillator(&self) -> OscillatorNode
Creates an OscillatorNode
, a source representing a periodic waveform.
sourcefn create_panner(&self) -> PannerNode
fn create_panner(&self) -> PannerNode
Creates a PannerNode
sourcefn create_periodic_wave(&self, options: PeriodicWaveOptions) -> PeriodicWave
fn create_periodic_wave(&self, options: PeriodicWaveOptions) -> PeriodicWave
Creates a periodic wave
sourcefn create_stereo_panner(&self) -> StereoPannerNode
fn create_stereo_panner(&self) -> StereoPannerNode
Creates an StereoPannerNode
to pan a stereo output
sourcefn create_wave_shaper(&self) -> WaveShaperNode
fn create_wave_shaper(&self) -> WaveShaperNode
Creates a WaveShaperNode
sourcefn create_audio_param(
&self,
opts: AudioParamDescriptor,
dest: &AudioNodeId
) -> (AudioParam, AudioParamId)
fn create_audio_param(
&self,
opts: AudioParamDescriptor,
dest: &AudioNodeId
) -> (AudioParam, AudioParamId)
Create an AudioParam
. Read more
sourcefn destination(&self) -> AudioDestinationNode
fn destination(&self) -> AudioDestinationNode
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
sourcefn listener(&self) -> AudioListener
fn listener(&self) -> AudioListener
Returns the AudioListener
which is used for 3D spatialization
sourcefn sample_rate(&self) -> f32
fn sample_rate(&self) -> f32
The sample rate (in sample-frames per second) at which the AudioContext
handles audio.
sourcefn sample_rate_raw(&self) -> SampleRate
fn sample_rate_raw(&self) -> SampleRate
The raw sample rate of the AudioContext
(which has more precision than the float
sample_rate()
value). Read more
sourcefn current_time(&self) -> f64
fn current_time(&self) -> f64
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
sourceimpl Clone for ConcreteBaseAudioContext
impl Clone for ConcreteBaseAudioContext
sourcefn clone(&self) -> ConcreteBaseAudioContext
fn clone(&self) -> ConcreteBaseAudioContext
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
Auto Trait Implementations
impl RefUnwindSafe for ConcreteBaseAudioContext
impl Send for ConcreteBaseAudioContext
impl Sync for ConcreteBaseAudioContext
impl Unpin for ConcreteBaseAudioContext
impl UnwindSafe for ConcreteBaseAudioContext
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<F, T> IntoSample<T> for F where
T: FromSample<F>,
impl<F, T> IntoSample<T> for F where
T: FromSample<F>,
fn into_sample(self) -> T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more