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§
Sourcefn new(length: usize, layout: AudioChannelLayout) -> AudioBufferInterleaved<T>
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.
Sourcefn get_channel_layout(&self) -> AudioChannelLayout
fn get_channel_layout(&self) -> AudioChannelLayout
Returns the current channel layout of the buffer.
Sourcefn set_channel_layout(&mut self, layout: AudioChannelLayout)
fn set_channel_layout(&mut self, layout: AudioChannelLayout)
Sets a new channel layout, potentially reallocating the buffer if the layout changes.
Sourcefn get_buffer(&self) -> &[T]
fn get_buffer(&self) -> &[T]
Returns an immutable reference to the entire interleaved buffer.
Sourcefn get_buffer_mut(&mut self) -> &mut [T]
fn get_buffer_mut(&mut self) -> &mut [T]
Returns a mutable reference to the entire interleaved buffer.
Sourcefn len_planar(&self) -> usize
fn len_planar(&self) -> usize
Returns the length per channel (planar length).
Sourcefn len_interleaved(&self) -> usize
fn len_interleaved(&self) -> usize
Returns the total interleaved length (channels * planar length).
Sourcefn resize(&mut self, new_len: usize)
fn resize(&mut self, new_len: usize)
Resizes the buffer to a new planar length, adjusting the total size accordingly.
Sourcefn copy_to_planar(&self, output: &mut AudioBuffer<T>)
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.