Skip to main content

AudioNodeProcessor

Trait AudioNodeProcessor 

Source
pub trait AudioNodeProcessor: 'static + Send {
    // Provided methods
    fn events(
        &mut self,
        info: &ProcInfo,
        events: &mut ProcEvents<'_>,
        extra: &mut ProcExtra,
    ) { ... }
    fn bypassed(&mut self, bypassed: bool) { ... }
    fn process(
        &mut self,
        info: &ProcInfo,
        buffers: ProcBuffers<'_, '_>,
        extra: &mut ProcExtra,
    ) -> ProcessStatus { ... }
    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.

Provided Methods§

Source

fn events( &mut self, info: &ProcInfo, events: &mut ProcEvents<'_>, extra: &mut ProcExtra, )

Called when there are new events for this node to process.

This is called once before the first call to process, and after that it will be called whenever there are new events (including when the node is bypassed).

Unless this node is bypassed, then AudioNodeProcessor::process will be called immediately after.

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

This is always called in a realtime thread, so do not perform any realtime-unsafe operations.

Source

fn bypassed(&mut self, bypassed: bool)

Called when the node has been fully bypassed/un-bypassed.

The Firewheel processor automatically handles bypass declicking, so there is no need to handle that manually.

This is always called in a realtime thread, so do not perform any realtime-unsafe operations.

Source

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

Process the given block of audio.

  • info - Information about this processing block.
  • buffers - The buffers of data 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. If using AudioNodeInfo::in_place_buffers, then the output buffers in the range [0..num_inputs_in_config.min(num_outputs_in_config)] do not need to be filled with data.

This is always called in a realtime thread, so do not perform any realtime-unsafe operations.

Source

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

Called when the audio stream has been stopped.

This may or may not be called in a realtime thread, so prefer not perform any realtime-unsafe operations.

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.

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

Trait Implementations§

Source§

impl AudioNodeProcessor for Box<dyn AudioNodeProcessor>

Source§

fn events( &mut self, info: &ProcInfo, events: &mut ProcEvents<'_>, extra: &mut ProcExtra, )

Called when there are new events for this node to process. Read more
Source§

fn bypassed(&mut self, bypassed: bool)

Called when the node has been fully bypassed/un-bypassed. Read more
Source§

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

Process the given block of audio. Read more
Source§

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

Called when the audio stream has been stopped. Read more
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

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 events( &mut self, info: &ProcInfo, events: &mut ProcEvents<'_>, extra: &mut ProcExtra, )

Source§

fn bypassed(&mut self, bypassed: bool)

Source§

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

Source§

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

Source§

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

Implementors§