Trait AudioNodeProcessor

Source
pub trait AudioNodeProcessor: 'static + Send {
    // Required method
    fn process(
        &mut self,
        buffers: ProcBuffers<'_, '_, '_, '_>,
        proc_info: &ProcInfo<'_>,
        events: NodeEventList<'_>,
    ) -> ProcessStatus;

    // Provided methods
    fn stream_stopped(&mut self) { ... }
    fn new_stream(&mut self, stream_info: &StreamInfo) { ... }
}
Expand description

The trait describing the realtime processor counterpart to an audio node.

Required Methods§

Source

fn process( &mut self, buffers: ProcBuffers<'_, '_, '_, '_>, proc_info: &ProcInfo<'_>, events: NodeEventList<'_>, ) -> ProcessStatus

Process the given block of audio. Only process data in the buffers up to samples.

The node MUST either return ProcessStatus::ClearAllOutputs or fill all output buffers with data.

If any output buffers contain all zeros up to samples (silent), then mark that buffer as silent in ProcInfo::out_silence_mask.

  • buffers - The buffers of data to process.
  • proc_info - Additional information about the process.
  • events - A list of events for this node to process.

Provided Methods§

Source

fn stream_stopped(&mut self)

Called when the audio stream has been stopped.

Source

fn new_stream(&mut self, stream_info: &StreamInfo)

Called when a new audio stream has been started after a previous call to AudioNodeProcessor::stream_stopped.

Note, this method gets called on the main thread, not the audio thread. So it is safe to allocate/deallocate here.

Implementors§