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§
Sourcefn process(
&mut self,
info: &ProcInfo,
buffers: ProcBuffers<'_, '_>,
events: &mut ProcEvents<'_>,
extra: &mut ProcExtra,
) -> ProcessStatus
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§
Sourcefn stream_stopped(&mut self, context: &mut ProcStreamCtx<'_>)
fn stream_stopped(&mut self, context: &mut ProcStreamCtx<'_>)
Called when the audio stream has been stopped.
Sourcefn new_stream(
&mut self,
stream_info: &StreamInfo,
context: &mut ProcStreamCtx<'_>,
)
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>
impl AudioNodeProcessor for Box<dyn AudioNodeProcessor>
Source§fn new_stream(
&mut self,
stream_info: &StreamInfo,
context: &mut ProcStreamCtx<'_>,
)
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 moreSource§fn process(
&mut self,
info: &ProcInfo,
buffers: ProcBuffers<'_, '_>,
events: &mut ProcEvents<'_>,
extra: &mut ProcExtra,
) -> ProcessStatus
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 moreSource§fn stream_stopped(&mut self, context: &mut ProcStreamCtx<'_>)
fn stream_stopped(&mut self, context: &mut ProcStreamCtx<'_>)
Called when the audio stream has been stopped.