AudioBufferInterleavedImpl

Trait AudioBufferInterleavedImpl 

Source
pub trait AudioBufferInterleavedImpl<T: FloatType>: Sized {
    // Required methods
    fn new(
        length: usize,
        layout: AudioChannelLayout,
    ) -> AudioBufferInterleaved<T>;
    fn reset(&mut self);
    fn get_channel_layout(&self) -> AudioChannelLayout;
    fn set_channel_layout(&mut self, layout: AudioChannelLayout);
    fn get_buffer(&self) -> &[T];
    fn get_buffer_mut(&mut self) -> &mut [T];
    fn len_planar(&self) -> usize;
    fn len_interleaved(&self) -> usize;
    fn resize(&mut self, new_len: usize);
    fn copy_to_planar(&self, output: &mut AudioBuffer<T>);
}
Expand description

Trait for interleaved audio buffer operations, where samples from all channels are stored in a single contiguous buffer (e.g., LRLRLR… for stereo).

Required Methods§

Source

fn new(length: usize, layout: AudioChannelLayout) -> AudioBufferInterleaved<T>

Creates a new interleaved audio buffer with the specified length (per channel) and channel layout. The total buffer length will be length * layout as usize.

Source

fn reset(&mut self)

Resets the buffer by filling it with zeros.

Source

fn get_channel_layout(&self) -> AudioChannelLayout

Returns the current channel layout of the buffer.

Source

fn set_channel_layout(&mut self, layout: AudioChannelLayout)

Sets a new channel layout, potentially reallocating the buffer if the layout changes.

Source

fn get_buffer(&self) -> &[T]

Returns an immutable reference to the entire interleaved buffer.

Source

fn get_buffer_mut(&mut self) -> &mut [T]

Returns a mutable reference to the entire interleaved buffer.

Source

fn len_planar(&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 resize(&mut self, new_len: usize)

Resizes the buffer to a new planar length, adjusting the total size accordingly.

Source

fn copy_to_planar(&self, output: &mut AudioBuffer<T>)

Copies the interleaved data into a planar AudioBuffer (separate buffers per channel).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§