pub trait Effect: Processor {
// Required methods
fn handle_parameters(&mut self, context: &impl HandleParametersContext);
fn process(
&mut self,
context: &impl ProcessContext,
input: &impl Buffer,
output: &mut impl BufferMut,
);
}Expand description
A trait for audio effects
An effect is a processor that processes audio, and has both an input and an output
audio stream. It will receive information about the current state of the parameters
specified by the crate::Component that created it.
Required Methods§
Sourcefn handle_parameters(&mut self, context: &impl HandleParametersContext)
fn handle_parameters(&mut self, context: &impl HandleParametersContext)
Handle parameter changes without processing any audio data.
Must not allocate or block.
Sourcefn process(
&mut self,
context: &impl ProcessContext,
input: &impl Buffer,
output: &mut impl BufferMut,
)
fn process( &mut self, context: &impl ProcessContext, input: &impl Buffer, output: &mut impl BufferMut, )
Actually process audio data.
Must not allocate or block.
input and output will be the same length.
output will be received in an undetermined state and must
be filled with audio by the processor during this call.
In addition to recieving the audio, this function also receives information about the state of the parameters throughout the buffer being processed.
The sample rate of the audio was provided in environment.sampling_rate
in the call to crate::Component::create_processor.
Note that it’s guaranteed that output will be no longer than
environment.max_samples_per_process_call provided in the call to
crate::Component::create_processor.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.