pub struct Smoother { /* private fields */ }Expand description
A parameter value smoother.
Can be used standalone for custom modulation, or integrated
into FloatParameter via .with_smoother().
§Thread Safety
Smoother is Send but not Sync - it requires &mut self for
advancing state. This is intentional for audio thread usage.
Implementations§
Source§impl Smoother
impl Smoother
Sourcepub fn new(style: SmoothingStyle) -> Self
pub fn new(style: SmoothingStyle) -> Self
Create a new smoother with the given style.
Sample rate must be set before use via set_sample_rate().
Sourcepub fn style(&self) -> SmoothingStyle
pub fn style(&self) -> SmoothingStyle
Get the smoothing style.
Sourcepub fn set_sample_rate(&mut self, sample_rate: f64)
pub fn set_sample_rate(&mut self, sample_rate: f64)
Set the sample rate.
Call this from Processor::setup(). Recomputes coefficients
based on time constants.
Sourcepub fn set_target(&mut self, target: f64)
pub fn set_target(&mut self, target: f64)
Set a new target value.
Call this when the parameter value changes (typically at start of process block).
Sourcepub fn reset(&mut self, value: f64)
pub fn reset(&mut self, value: f64)
Reset immediately to a value (no smoothing).
Use when loading state or initializing to avoid ramps.
Sourcepub fn tick(&mut self) -> f64
pub fn tick(&mut self) -> f64
Advance by one sample and return the smoothed value.
Call this once per sample in the audio loop.
Sourcepub fn skip(&mut self, samples: usize)
pub fn skip(&mut self, samples: usize)
Skip forward by n samples (for block processing).
This is equivalent to calling tick() n times but may be optimized
for some smoothing styles.
Sourcepub fn is_smoothing(&self) -> bool
pub fn is_smoothing(&self) -> bool
Returns true if still smoothing toward target.