AudioBuffer

Struct AudioBuffer 

Source
pub struct AudioBuffer<T: FloatType> { /* private fields */ }

Trait Implementations§

Source§

impl<T: FloatType> AudioBufferImpl<T> for AudioBuffer<T>

Source§

fn new(len: usize, layout: AudioChannelLayout) -> AudioBuffer<T>

Creates a new planar audio buffer with the specified length (per channel) and channel layout.
Source§

fn new_with_layout(layout: AudioChannelLayout) -> AudioBuffer<T>

Creates a new planar audio buffer with default length (0) and the specified layout.
Source§

fn get_channel(&self, channel: usize) -> &[T]

Returns an immutable slice for the specified channel. Panics if the channel index exceeds the layout’s channel count.
Source§

fn get_channel_mut(&mut self, channel: usize) -> &mut [T]

Returns a mutable slice for the specified channel. Panics if the channel index exceeds the layout’s channel count.
Source§

unsafe fn get_channel_unchecked(&self, channel: usize) -> &[T]

Returns an immutable slice for the specified channel without bounds checking.
Source§

unsafe fn get_channel_unchecked_mut(&mut self, channel: usize) -> &mut [T]

Returns a mutable slice for the specified channel without bounds checking.
Source§

fn resize(&mut self, new_len: usize)

Resizes all channel buffers to the new length, filling new space with zeros.
Source§

fn copy_to_interleaved(&self, dst: &mut [T])

Copies all channels’ data into an interleaved destination slice. Panics if the destination length does not match self.len() * self.channel_layout() as usize.
Source§

fn mix_with(&mut self, other: &AudioBuffer<T>)

Mixes another AudioBuffer into this one without applying gain. Panics if lengths or layouts do not match.
Source§

fn mix_with_gain(&mut self, other: &AudioBuffer<T>, gain: f32)

Mixes another AudioBuffer into this one with the specified gain applied to the other buffer. Panics if lengths or layouts do not match.
Source§

fn copy_from(&mut self, other: &AudioBuffer<T>)

Copies data from another AudioBuffer. Panics if lengths or layouts do not match.
Source§

fn copy_from_interleaved(&mut self, buffer: &[T])

Copies data from an interleaved buffer. Panics if the interleaved length does not match the expected size.
Source§

fn copy_from_interleaved_range( &mut self, input: &[T], start: usize, end: usize, offset: usize, )

Copies a range from an interleaved input buffer, starting at an offset. Read more
Source§

fn channel_layout(&self) -> AudioChannelLayout

Returns the current channel layout.
Source§

fn set_channel_layout(&mut self, new_layout: AudioChannelLayout)

Sets a new channel layout, converting the audio signal into new layout.
Source§

fn reset(&mut self)

Resets all buffers by filling them with zeros.
Source§

fn len(&self) -> usize

Returns the length per channel (planar length).
Source§

fn len_interleaved(&self) -> usize

Returns the total interleaved length (channels * planar length).
Source§

fn to_f32(&self) -> AudioBuffer<f32>

Converts this buffer to a cloned AudioBuffer with f32 samples.
Source§

fn to_f64(&self) -> AudioBuffer<f64>

Converts this buffer to a cloned AudioBuffer with f64 samples.
Source§

impl<T: FloatType> AudioBufferMathImpl<T> for AudioBuffer<T>

Source§

fn normalize_rms(&mut self, rms_factor: T)

This adjusts the audio levels to a target RMS value.
Source§

fn normalize(&mut self, factor: T)

Useful for gain adjustments.
Source§

impl<T: Clone + FloatType> Clone for AudioBuffer<T>

Source§

fn clone(&self) -> AudioBuffer<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug + FloatType> Debug for AudioBuffer<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T> Freeze for AudioBuffer<T>

§

impl<T> RefUnwindSafe for AudioBuffer<T>
where T: RefUnwindSafe,

§

impl<T> Send for AudioBuffer<T>
where T: Send,

§

impl<T> Sync for AudioBuffer<T>
where T: Sync,

§

impl<T> Unpin for AudioBuffer<T>
where T: Unpin,

§

impl<T> UnwindSafe for AudioBuffer<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,