Trait Modulator
pub trait Modulator {
// Required methods
fn tick(&mut self) -> f64;
fn reset(&mut self);
fn set_rate(&mut self, hz: f64);
fn rate(&self) -> f64;
fn set_sample_rate(&mut self, sample_rate: f64);
}Expand description
Modulation source that generates control signals.
LFOs, envelope followers, and similar generators implement this trait. Output is typically in the range [-1, 1] or [0, 1] depending on use case.
Required Methods§
fn tick(&mut self) -> f64
fn tick(&mut self) -> f64
Generate the next modulation sample.
Returns a value typically in [-1, 1] (bipolar) or [0, 1] (unipolar).
fn reset(&mut self)
fn reset(&mut self)
Reset the modulator to its initial state.
fn set_sample_rate(&mut self, sample_rate: f64)
fn set_sample_rate(&mut self, sample_rate: f64)
Update sample rate when audio engine changes.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".