Skip to main content

AudioNodeProcessor

Trait AudioNodeProcessor 

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

    // Provided methods
    fn stream_stopped(&mut self, context: &mut ProcStreamCtx<'_>) { ... }
    fn new_stream(
        &mut self,
        stream_info: &StreamInfo,
        context: &mut ProcStreamCtx<'_>,
    ) { ... }
}
Expand description

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

Required Methods§

Source

fn process( &mut self, info: &ProcInfo, buffers: ProcBuffers<'_, '_>, events: &mut ProcEvents<'_>, extra: &mut ProcExtra, ) -> ProcessStatus

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

  • info - Information about this processing block.
  • buffers - The buffers of data to process.
  • events - A list of events for this node to process.
  • extra - Additional buffers and utilities.

WARNING: Audio nodes MUST either completely fill all output buffers with data, or return ProcessStatus::ClearAllOutputs/ProcessStatus::Bypass. Failing to do this will result in audio glitches.

Provided Methods§

Source

fn stream_stopped(&mut self, context: &mut ProcStreamCtx<'_>)

Called when the audio stream has been stopped.

Source

fn new_stream( &mut self, stream_info: &StreamInfo, context: &mut ProcStreamCtx<'_>, )

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.

Trait Implementations§

Source§

impl AudioNodeProcessor for Box<dyn AudioNodeProcessor>

Source§

fn new_stream( &mut self, stream_info: &StreamInfo, context: &mut ProcStreamCtx<'_>, )

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

fn process( &mut self, info: &ProcInfo, buffers: ProcBuffers<'_, '_>, events: &mut ProcEvents<'_>, extra: &mut ProcExtra, ) -> ProcessStatus

Process the given block of audio. Only process data in the buffers up to samples. Read more
Source§

fn stream_stopped(&mut self, context: &mut ProcStreamCtx<'_>)

Called when the audio stream has been stopped.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl AudioNodeProcessor for Box<dyn AudioNodeProcessor>

Source§

fn new_stream( &mut self, stream_info: &StreamInfo, context: &mut ProcStreamCtx<'_>, )

Source§

fn process( &mut self, info: &ProcInfo, buffers: ProcBuffers<'_, '_>, events: &mut ProcEvents<'_>, extra: &mut ProcExtra, ) -> ProcessStatus

Source§

fn stream_stopped(&mut self, context: &mut ProcStreamCtx<'_>)

Implementors§