pub trait Effect: Send + Sync {
// Required method
fn process(
&mut self,
input: Frame,
dt: f64,
clock_info_provider: &ClockInfoProvider<'_>,
modulator_value_provider: &ModulatorValueProvider<'_>,
) -> Frame;
// Provided methods
fn init(&mut self, sample_rate: u32) { ... }
fn on_change_sample_rate(&mut self, sample_rate: u32) { ... }
fn on_start_processing(&mut self) { ... }
}Expand description
Receives input audio from a mixer track and outputs modified audio.
For performance reasons, avoid allocating and deallocating in any methods
of this trait besides on_change_sample_rate.
Required Methods§
fn process(
&mut self,
input: Frame,
dt: f64,
clock_info_provider: &ClockInfoProvider<'_>,
modulator_value_provider: &ModulatorValueProvider<'_>,
) -> Frame
fn process( &mut self, input: Frame, dt: f64, clock_info_provider: &ClockInfoProvider<'_>, modulator_value_provider: &ModulatorValueProvider<'_>, ) -> Frame
Transforms an input Frame.
dt is the time that’s elapsed since the previous round of
processing (in seconds).
Provided Methods§
fn on_change_sample_rate(&mut self, sample_rate: u32)
fn on_change_sample_rate(&mut self, sample_rate: u32)
Called when the sample rate of the renderer is changed.
fn on_start_processing(&mut self)
fn on_start_processing(&mut self)
Called whenever a new batch of audio samples is requested by the backend.
This is a good place to put code that needs to run fairly frequently, but not for every single audio sample.