pub struct ChannelBuffer<T: Clone + Copy + Default, const CHANNELS: usize> { /* private fields */ }Expand description
A memory-efficient buffer of samples with CHANNELS channels. Each channel
has a length of frames.
Implementations§
Source§impl<T: Clone + Copy + Default, const CHANNELS: usize> ChannelBuffer<T, CHANNELS>
impl<T: Clone + Copy + Default, const CHANNELS: usize> ChannelBuffer<T, CHANNELS>
pub const fn empty() -> Self
pub fn new(frames: usize) -> Self
pub fn frames(&self) -> usize
Sourcepub fn first_with_frames(&self, frames: usize) -> &[T]
pub fn first_with_frames(&self, frames: usize) -> &[T]
Get an immutable reference to the first channel with the given number of frames.
The length of the returned slice will be either frames or the number of
frames in this buffer, whichever is smaller.
Sourcepub fn first_with_frames_mut(&mut self, frames: usize) -> &mut [T]
pub fn first_with_frames_mut(&mut self, frames: usize) -> &mut [T]
Get a mutable reference to the first channel with the given number of frames.
The length of the returned slice will be either frames or the number of
frames in this buffer, whichever is smaller.
Sourcepub fn all(&self) -> [&[T]; CHANNELS]
pub fn all(&self) -> [&[T]; CHANNELS]
Get an immutable reference to all channels in this buffer.
Sourcepub fn all_mut(&mut self) -> [&mut [T]; CHANNELS]
pub fn all_mut(&mut self) -> [&mut [T]; CHANNELS]
Get a mutable reference to all channels in this buffer.
Sourcepub fn all_with_frames(&self, frames: usize) -> [&[T]; CHANNELS]
pub fn all_with_frames(&self, frames: usize) -> [&[T]; CHANNELS]
Get an immutable reference to all channels with the given number of frames.
The length of the returned slices will be either frames or the number of
frames in this buffer, whichever is smaller.
Sourcepub fn all_with_frames_mut(&mut self, frames: usize) -> [&mut [T]; CHANNELS]
pub fn all_with_frames_mut(&mut self, frames: usize) -> [&mut [T]; CHANNELS]
Get a mutable reference to all channels with the given number of frames.
The length of the returned slices will be either frames or the number of
frames in this buffer, whichever is smaller.
Auto Trait Implementations§
impl<T, const CHANNELS: usize> Freeze for ChannelBuffer<T, CHANNELS>
impl<T, const CHANNELS: usize> RefUnwindSafe for ChannelBuffer<T, CHANNELS>where
T: RefUnwindSafe,
impl<T, const CHANNELS: usize> Send for ChannelBuffer<T, CHANNELS>where
T: Send,
impl<T, const CHANNELS: usize> Sync for ChannelBuffer<T, CHANNELS>where
T: Sync,
impl<T, const CHANNELS: usize> Unpin for ChannelBuffer<T, CHANNELS>where
T: Unpin,
impl<T, const CHANNELS: usize> UnwindSafe for ChannelBuffer<T, CHANNELS>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.