pub struct BufferArray<N>where
N: ArrayLength,{ /* private fields */ }Expand description
An owned audio buffer stored inline as an array with an arbitrary number of channels
containing 64 (MAX_BUFFER_SIZE) samples per channel.
Samples are stored non-interleaved.
The number of channels must be known at compile time:
the size N is given as a type-level integer (U0, U1, …).
Implementations§
Source§impl<N> BufferArray<N>where
N: ArrayLength,
impl<N> BufferArray<N>where
N: ArrayLength,
Sourcepub fn new() -> BufferArray<N>
pub fn new() -> BufferArray<N>
Create new buffer and initialize it with zeros.
Sourcepub fn at(&self, channel: usize, i: usize) -> f32x8
pub fn at(&self, channel: usize, i: usize) -> f32x8
Access value at index i (0 <= i <= 7) of channel.
Sourcepub fn at_f32(&self, channel: usize, i: usize) -> f32
pub fn at_f32(&self, channel: usize, i: usize) -> f32
Get f32 value at index i (0 <= i <= 63) of channel.
Sourcepub fn set(&mut self, channel: usize, i: usize, value: f32x8)
pub fn set(&mut self, channel: usize, i: usize, value: f32x8)
Set value at index i (0 <= i <= 7) of channel.
Sourcepub fn set_f32(&mut self, channel: usize, i: usize, value: f32)
pub fn set_f32(&mut self, channel: usize, i: usize, value: f32)
Get f32 value at index i (0 <= i <= 63) of channel.
Sourcepub fn channel_mut(&mut self, channel: usize) -> &mut [f32x8]
pub fn channel_mut(&mut self, channel: usize) -> &mut [f32x8]
Get mutable channel slice.
Sourcepub fn channel_f32(&mut self, channel: usize) -> &[f32]
pub fn channel_f32(&mut self, channel: usize) -> &[f32]
Get channel as a scalar slice.
Sourcepub fn channel_f32_mut(&mut self, channel: usize) -> &mut [f32]
pub fn channel_f32_mut(&mut self, channel: usize) -> &mut [f32]
Get channel as a mutable scalar slice.
Sourcepub fn buffer_ref(&self) -> BufferRef<'_>
pub fn buffer_ref(&self) -> BufferRef<'_>
Get immutably borrowed buffer.
Sourcepub fn buffer_mut(&mut self) -> BufferMut<'_>
pub fn buffer_mut(&mut self) -> BufferMut<'_>
Get mutably borrowed buffer.
Trait Implementations§
Source§impl<N> Clone for BufferArray<N>where
N: Clone + ArrayLength,
impl<N> Clone for BufferArray<N>where
N: Clone + ArrayLength,
Source§fn clone(&self) -> BufferArray<N>
fn clone(&self) -> BufferArray<N>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<N> Default for BufferArray<N>where
N: Default + ArrayLength,
impl<N> Default for BufferArray<N>where
N: Default + ArrayLength,
Source§fn default() -> BufferArray<N>
fn default() -> BufferArray<N>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl<N> Freeze for BufferArray<N>
impl<N> RefUnwindSafe for BufferArray<N>
impl<N> Send for BufferArray<N>
impl<N> Sync for BufferArray<N>
impl<N> Unpin for BufferArray<N>
impl<N> UnsafeUnpin for BufferArray<N>
impl<N> UnwindSafe for BufferArray<N>
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ConditionalSend for Twhere
T: Send,
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>
Converts
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>
Converts
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)
Converts
&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)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
Source§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self using default().
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more