Trait AudioProcessor

Source
pub trait AudioProcessor {
    type SampleType: Sized;

    // Required method
    fn process(
        &mut self,
        _context: &mut AudioContext,
        data: &mut AudioBuffer<Self::SampleType>,
    );

    // Provided method
    fn prepare(&mut self, _context: &mut AudioContext) { ... }
}
Expand description

Represents an audio processing node.

Implementors should define the SampleType the node will work over. See some examples here.

Required Associated Types§

Required Methods§

Source

fn process( &mut self, _context: &mut AudioContext, data: &mut AudioBuffer<Self::SampleType>, )

Process a block of samples by mutating the input AudioBuffer

Provided Methods§

Source

fn prepare(&mut self, _context: &mut AudioContext)

Prepare for playback based on current audio settings

Implementors§

Source§

impl<Processor: MonoAudioProcessor> AudioProcessor for MonoCopyProcessor<Processor>
where Processor::SampleType: Zero + AddAssign + DivAssign + From<f32>,

Source§

impl<Processor: MonoAudioProcessor> AudioProcessor for MultiChannel<Processor>

Source§

impl<SampleType: Send + Copy> AudioProcessor for NoopAudioProcessor<SampleType>

Source§

type SampleType = SampleType

Source§

impl<SampleType: Float + Send + Sized> AudioProcessor for SilenceAudioProcessor<SampleType>

Source§

type SampleType = SampleType