Trait rotary::Buf [−][src]
A trait describing an immutable audio buffer.
Required methods
fn frames(&self) -> usize
[src]
The number of frames in a buffer.
fn channels(&self) -> usize
[src]
The number of channels in the buffer.
fn channel(&self, channel: usize) -> BufChannel<'_, T>
[src]
Return a handler to the buffer associated with the channel.
Note that we don’t access the buffer for the underlying channel directly
as a linear buffer like &[T]
, because the underlying representation
might be different.
We must instead make use of the various utility functions found on BufChannel to copy data out of the channel.
Panics
Panics if the specified channel is out of bound as reported by Buf::channels.
Provided methods
fn offset(self, offset: usize) -> Offset<Self> where
Self: Sized,
[src]
Self: Sized,
Offset the buffer to process by offset
number of frames.
Examples
use rotary::{Buf as _, BufMut as _}; let mut buffer = rotary::Interleaved::with_topology(2, 4); (&mut buffer).offset(2).channel_mut(0).copy_from_slice(&[1.0, 1.0]); assert_eq!(buffer.as_slice(), &[0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0])
fn limit(self, limit: usize) -> Limit<Self> where
Self: Sized,
[src]
Self: Sized,
Limit the buffer to process by limit
number of frames.
Examples
use rotary::{Buf as _, BufMut as _}; let from = rotary::interleaved![[1.0f32; 4]; 2]; let mut to = rotary::Interleaved::<f32>::with_topology(2, 4); to.channel_mut(0).copy_from(from.limit(2).channel(0)); assert_eq!(to.as_slice(), &[1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0]);
Implementations on Foreign Types
impl<B, T> Buf<T> for &B where
B: Buf<T>,
[src]
B: Buf<T>,
fn frames(&self) -> usize
[src]
fn channels(&self) -> usize
[src]
fn channel(&self, channel: usize) -> BufChannel<'_, T>
[src]
impl<B, T> Buf<T> for &mut B where
B: Buf<T>,
[src]
B: Buf<T>,
fn frames(&self) -> usize
[src]
fn channels(&self) -> usize
[src]
fn channel(&self, channel: usize) -> BufChannel<'_, T>
[src]
impl<T> Buf<T> for Vec<Vec<T>>
[src]
fn frames(&self) -> usize
[src]
fn channels(&self) -> usize
[src]
fn channel(&self, channel: usize) -> BufChannel<'_, T>
[src]
impl<T> Buf<T> for [Vec<T>]
[src]
fn frames(&self) -> usize
[src]
fn channels(&self) -> usize
[src]
fn channel(&self, channel: usize) -> BufChannel<'_, T>
[src]
Implementors
impl<T> Buf<T> for Dynamic<T> where
T: Sample,
[src]
T: Sample,
fn frames(&self) -> usize
[src]
fn channels(&self) -> usize
[src]
fn channel(&self, channel: usize) -> BufChannel<'_, T>
[src]
impl<T> Buf<T> for rotary::interleaved::Interleaved<T> where
T: Sample,
[src]
T: Sample,
fn frames(&self) -> usize
[src]
fn channels(&self) -> usize
[src]
fn channel(&self, channel: usize) -> BufChannel<'_, T>
[src]
impl<T> Buf<T> for rotary::sequential::Sequential<T> where
T: Sample,
[src]
T: Sample,
fn frames(&self) -> usize
[src]
fn channels(&self) -> usize
[src]
fn channel(&self, channel: usize) -> BufChannel<'_, T>
[src]
impl<T, S> Buf<S> for rotary::wrap::Interleaved<T> where
T: AsRef<[S]>,
[src]
T: AsRef<[S]>,
fn frames(&self) -> usize
[src]
fn channels(&self) -> usize
[src]
fn channel(&self, channel: usize) -> BufChannel<'_, S>
[src]
impl<T, S> Buf<S> for rotary::wrap::Sequential<T> where
T: AsRef<[S]>,
[src]
T: AsRef<[S]>,