Struct rsynth::buffer::AudioChunk [−][src]
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]
S: Zero,
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]
iterator: I,
number_of_channels: usize
) -> Self where
I: Iterator<Item = S>,
S: Copy,
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]
Notable traits for InterlacedSampleIterator<'a, S>
impl<'a, S> Iterator for InterlacedSampleIterator<'a, S> where
S: Copy, type Item = S;
S: Copy,
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]
S: Clone,
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]
fn clone(&self) -> AudioChunk<S>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[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]
fn eq(&self, other: &AudioChunk<S>) -> bool
[src]
fn ne(&self, other: &AudioChunk<S>) -> bool
[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,
S: RefUnwindSafe,
impl<S> Send for AudioChunk<S> where
S: Send,
S: Send,
impl<S> Sync for AudioChunk<S> where
S: Sync,
S: Sync,
impl<S> Unpin for AudioChunk<S> where
S: Unpin,
S: Unpin,
impl<S> UnwindSafe for AudioChunk<S> where
S: UnwindSafe,
S: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<S, T> Duplex<S> for T where
T: FromSample<S> + ToSample<S>,
T: FromSample<S> + ToSample<S>,
impl<T> From<T> for T
[src]
impl<S> FromSample<S> for S
pub fn from_sample_(s: S) -> S
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> ToSample<U> for T where
U: FromSample<T>,
U: FromSample<T>,
pub fn to_sample_(self) -> U
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,