class
SushiDSP::SmoothedParameter
First-order (one-pole) parameter smoother with a time constant in milliseconds, derived from the sample rate at prepare() so a knob feels the same at every rate and block size.
- Declared in
include/SushiDSP/math/SmoothedParameter.hpp
set_target() is a single float store and is safe to call from the audio thread; all advancing happens on the audio thread.
Public member functions
explicit SmoothedParameter(float initial_value=0.0f)Parameters
initial_valueValue both current and target start at.
void prepare(double sample_rate, float time_constant_ms)Derives the per-sample coefficient.
Control thread only.
Parameters
sample_rateThe rate next() will be called at (base or oversampled).
time_constant_msTime to reach 63 % of a step.
void set_target(float target)Sets the value the smoother moves toward.
Parameters
targetThe new target.
float next()Advances one sample.
Returns
The smoothed value after this sample.
float skip(std::uint32_t samples)Advances samples samples in one step (closed form).
Parameters
samplesNumber of samples to advance.
Returns
The smoothed value after those samples.
float current() constThe current smoothed value.
float target() constThe target value.
bool is_settled(float tolerance=1e-6f) constWhether |current - target| is within tolerance.
Parameters
toleranceAbsolute tolerance.
Returns
True when settled.
void snap(float value)Sets current and target to value with no ramp.
Parameters
valueThe value to snap to.

