Class ParameterSmoother
One-pole exponential smoother for click-free parameter changes. Ramps a value towards a target with a configurable time constant, evaluated one sample at a time. Allocation-free.
public sealed class ParameterSmoother
- Inheritance
-
ParameterSmoother
- Inherited Members
Properties
Current
The most recent smoothed value.
public float Current { get; }
Property Value
IsSettled
True when the smoothed value has effectively reached the target.
public bool IsSettled { get; }
Property Value
Target
The value the smoother is ramping towards.
public float Target { get; }
Property Value
Methods
Configure(int, float)
Sets the sample rate and smoothing time and recomputes the one-pole coefficient. Does not change the current or target value.
public void Configure(int sampleRate, float smoothingMilliseconds = 10)
Parameters
sampleRateintSample rate in Hz. Must be positive.
smoothingMillisecondsfloatApproximate time to converge towards a new target. Must be positive.
Process()
Advances one sample and returns the next smoothed value.
public float Process()
Returns
Reset(float)
Immediately jumps the current and target value, with no ramp.
public void Reset(float value)
Parameters
valuefloat
SetTarget(float)
Sets the target the smoother ramps towards.
public void SetTarget(float value)
Parameters
valuefloat