Struct web_audio_api::alloc::AudioBuffer [−][src]
pub struct AudioBuffer { /* fields omitted */ }Expand description
Fixed length audio asset, basically a matrix of channels * [f32; BUFFER_SIZE]
An AudioBuffer has copy-on-write semantics, so it is cheap to clone.
Implementations
impl AudioBuffer[src]
impl AudioBuffer[src]pub fn new(channel: ChannelData) -> Self[src]
pub fn number_of_channels(&self) -> usize[src]
pub fn number_of_channels(&self) -> usize[src]Number of channels in this AudioBuffer
pub fn set_number_of_channels(&mut self, n: usize)[src]
pub fn set_number_of_channels(&mut self, n: usize)[src]Set number of channels in this AudioBuffer
Note: if the new number is higher than the previous, the new channels will be filled with garbage.
pub fn channel_data(&self, index: usize) -> &ChannelData[src]
pub fn channel_data(&self, index: usize) -> &ChannelData[src]Get the samples from this specific channel.
Panics if the index is greater than the available number of channels
pub fn channel_data_mut(&mut self, index: usize) -> &mut ChannelData[src]
pub fn channel_data_mut(&mut self, index: usize) -> &mut ChannelData[src]Get the samples (mutable) from this specific channel.
Panics if the index is greater than the available number of channels
pub fn channels(&self) -> &[ChannelData][src]
pub fn channels(&self) -> &[ChannelData][src]Channel data as slice
pub fn channels_mut(&mut self) -> &mut [ChannelData][src]
pub fn channels_mut(&mut self) -> &mut [ChannelData][src]Channel data as slice (mutable)
pub fn mix(&mut self, channels: usize, interpretation: ChannelInterpretation)[src]
pub fn mix(&mut self, channels: usize, interpretation: ChannelInterpretation)[src]Up/Down-mix to the desired number of channels
pub fn make_silent(&mut self)[src]
pub fn make_silent(&mut self)[src]Convert this buffer to silence
pub fn force_mono(&mut self)[src]
pub fn force_mono(&mut self)[src]Convert to a single channel buffer, dropping excess channels
pub fn modify_channels<F: Fn(&mut ChannelData)>(&mut self, fun: F)[src]
pub fn modify_channels<F: Fn(&mut ChannelData)>(&mut self, fun: F)[src]Modify every channel in the same way
pub fn add(&mut self, other: &Self, interpretation: ChannelInterpretation)[src]
pub fn add(&mut self, other: &Self, interpretation: ChannelInterpretation)[src]Sum two AudioBuffers
If the channel counts differ, the buffer with lower count will be upmixed.
Trait Implementations
impl Clone for AudioBuffer[src]
impl Clone for AudioBuffer[src]fn clone(&self) -> AudioBuffer[src]
fn clone(&self) -> AudioBuffer[src]Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)1.0.0[src]Performs copy-assignment from source. Read more
Auto Trait Implementations
impl !RefUnwindSafe for AudioBuffer
impl !Send for AudioBuffer
impl !Sync for AudioBuffer
impl Unpin for AudioBuffer
impl !UnwindSafe for AudioBuffer
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]pub fn borrow_mut(&mut self) -> &mut T[src]
pub fn borrow_mut(&mut self) -> &mut T[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone, [src]
impl<T> ToOwned for T where
T: Clone, [src]type Owned = T
type Owned = TThe resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn to_owned(&self) -> T[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)[src]
pub fn clone_into(&self, target: &mut T)[src]🔬 This is a nightly-only experimental API. (toowned_clone_into)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more