Trait audio_processor_traits::audio_buffer::AudioBuffer [−][src]
pub trait AudioBuffer { type SampleType: Float + Sync + Send; fn num_channels(&self) -> usize; fn num_samples(&self) -> usize; fn get(&self, channel: usize, sample: usize) -> &Self::SampleType; fn get_mut(
&mut self,
channel: usize,
sample: usize
) -> &mut Self::SampleType; fn set(&mut self, channel: usize, sample: usize, value: Self::SampleType); fn iter(&self) -> AudioBufferIterator<'_, Self>ⓘ{ ... } }Notable traits for AudioBufferIterator<'a, BufferType>
impl<'a, BufferType: AudioBuffer> Iterator for AudioBufferIterator<'a, BufferType> type Item = AudioFrameReference<'a, BufferType>;
Expand description
Represents an audio buffer. This decouples audio processing code from a certain representation of multi-channel sample buffers.
This crate provides implementations of this trait for VST & CPal style buffers, which have different internal representations.
Associated Types
type SampleType: Float + Sync + Send
type SampleType: Float + Sync + Send
The type of samples within this buffer. Currently restricted to num::Float numbers.
Required methods
fn num_channels(&self) -> usize
fn num_channels(&self) -> usize
The number of channels in this buffer
fn num_samples(&self) -> usize
fn num_samples(&self) -> usize
The number of samples in this buffer
fn get(&self, channel: usize, sample: usize) -> &Self::SampleType
fn get(&self, channel: usize, sample: usize) -> &Self::SampleType
Get a ref to an INPUT sample in this buffer
fn get_mut(&mut self, channel: usize, sample: usize) -> &mut Self::SampleType
fn get_mut(&mut self, channel: usize, sample: usize) -> &mut Self::SampleType
Get a mutable ref to an OUTPUT sample in this buffer
On some implementations this may yield a different value than .get
.
fn set(&mut self, channel: usize, sample: usize, value: Self::SampleType)
fn set(&mut self, channel: usize, sample: usize, value: Self::SampleType)
Set an OUTPUT sample in this buffer
Provided methods
fn iter(&self) -> AudioBufferIterator<'_, Self>ⓘNotable traits for AudioBufferIterator<'a, BufferType>
impl<'a, BufferType: AudioBuffer> Iterator for AudioBufferIterator<'a, BufferType> type Item = AudioFrameReference<'a, BufferType>;
fn iter(&self) -> AudioBufferIterator<'_, Self>ⓘNotable traits for AudioBufferIterator<'a, BufferType>
impl<'a, BufferType: AudioBuffer> Iterator for AudioBufferIterator<'a, BufferType> type Item = AudioFrameReference<'a, BufferType>;
Create a read only iterator
Implementors
impl<'a, SampleType: Float + Sync + Send> AudioBuffer for InterleavedAudioBuffer<'a, SampleType>