Struct rsynth::buffer::AudioChunk[][src]

pub struct AudioChunk<S> { /* fields omitted */ }

A buffer representing a fixed amount of samples for a fixed amount of audio channels.

An AudioChunk “owns” all its samples.

Implementations

impl<S> AudioChunk<S>[src]

pub fn new(number_of_channels: usize) -> Self[src]

Create a new AudioChunk.

Panics

Panics if number_of_channels == 0.

Note: cannot be used in a real-time context

This method allocates memory and cannot be used in a real-time context.

pub fn zero(number_of_channels: usize, number_of_frames: usize) -> Self where
    S: Zero
[src]

Note: cannot be used in a real-time context

This method allocates memory and cannot be used in a real-time context.

pub fn from_channels(channels: Vec<Vec<S>>) -> Self[src]

pub fn from_interlaced_iterator<I>(
    iterator: I,
    number_of_channels: usize
) -> Self where
    I: Iterator<Item = S>,
    S: Copy
[src]

Panics

Panics if number_of_channels == 0. Panics if the number of elements yielded by the iterator is not an integer multiple of number_of_channels.

pub fn interlaced<'a>(&'a self) -> InterlacedSampleIterator<'a, S>

Notable traits for InterlacedSampleIterator<'a, S>

impl<'a, S> Iterator for InterlacedSampleIterator<'a, S> where
    S: Copy
type Item = S;
where
    S: Copy
[src]

Create an interlaced iterator from an AudioChunk

Example

#[macro_use]
extern crate rsynth;
let chunk = audio_chunk![[0, 1, 2], [3, 4, 5]];
let iterator = chunk.interlaced();
let interlaced: Vec<_> = iterator.collect();
assert_eq!(interlaced, vec![0, 3, 1, 4, 2, 5]);

pub fn with_capacity(number_of_channels: usize, capacity: usize) -> Self[src]

Create a new AudioChunk in which each channel has the given capacity. This allows to append capacity frames to the AudioChunk (e.g. by calling append_sliced_chunk).

Note: cannot be used in a real-time context

This method allocates memory and cannot be used in a real-time context.

pub fn channels(&self) -> &Vec<Vec<S>>[src]

pub fn number_of_channels(&self) -> usize[src]

Return the number of channels.

pub fn append_sliced_chunk(&mut self, chunk: &[&[S]]) where
    S: Clone
[src]

Note about using in a real-time context

This method will allocate memory if the capacity of the chunk is exceeded and cannot be used in a real-time context in that case.

pub fn inner(self) -> Vec<Vec<S>>[src]

pub fn as_slices<'a>(&'a self) -> Vec<&[S]>[src]

Note: cannot be used in a real-time context

This method allocates memory and cannot be used in a real-time context.

pub fn as_mut_slices<'a>(&'a mut self) -> Vec<&mut [S]>[src]

Note: cannot be used in a real-time context

This method allocates memory and cannot be used in a real-time context.

pub fn split(self, number_of_frames_per_chunk: usize) -> Vec<Self>[src]

Note: cannot be used in a real-time context

This method allocates memory and cannot be used in a real-time context.

Trait Implementations

impl<S: Clone> Clone for AudioChunk<S>[src]

impl<S: Debug> Debug for AudioChunk<S>[src]

impl<S: Eq> Eq for AudioChunk<S>[src]

impl<S: PartialEq> PartialEq<AudioChunk<S>> for AudioChunk<S>[src]

impl<S> StructuralEq for AudioChunk<S>[src]

impl<S> StructuralPartialEq for AudioChunk<S>[src]

Auto Trait Implementations

impl<S> RefUnwindSafe for AudioChunk<S> where
    S: RefUnwindSafe

impl<S> Send for AudioChunk<S> where
    S: Send

impl<S> Sync for AudioChunk<S> where
    S: Sync

impl<S> Unpin for AudioChunk<S> where
    S: Unpin

impl<S> UnwindSafe for AudioChunk<S> where
    S: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<S, T> Duplex<S> for T where
    T: FromSample<S> + ToSample<S>, 

impl<T> From<T> for T[src]

impl<S> FromSample<S> for S

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> ToSample<U> for T where
    U: FromSample<T>, 

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.