Trait Effect
pub trait Effect: Send {
// Required method
fn process(&mut self, input: &mut [Frame], dt: f64, info: &Info<'_>);
// Provided methods
fn init(&mut self, sample_rate: u32, internal_buffer_size: usize) { ... }
fn on_change_sample_rate(&mut self, sample_rate: u32) { ... }
fn on_start_processing(&mut self) { ... }
}
Available on crate feature
dep_kira
only.Expand description
Receives input audio from a mixer track and outputs modified audio.
For performance reasons, avoid allocating and deallocating memory in any methods
of this trait besides on_change_sample_rate
.
Required Methods§
Provided Methods§
fn init(&mut self, sample_rate: u32, internal_buffer_size: usize)
fn init(&mut self, sample_rate: u32, internal_buffer_size: usize)
Called when the effect is first sent to the renderer.
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.