You create your SmoothedValue for a floating type (float, double) and a smoothing type. Linear smoothing makes ramps. Multiplicative smoothing is linear in log -that is, if you use it for frequency it will be linear in pitch, if you use it for amplitude it will be linear in level (dB).
SmoothedValue<float /*, ValueSmoothingTypes::Linear */> yourValue; // linear by default
SmoothedValue yourValue{ 0.5f }; // floating type deduced from initial value
To set the length of your ramp, call reset. You can set a length in samples directly, or a sample rate and a length in seconds.
yourValue.reset (4410); // in samples
yourValue.reset (44100.0, 0.1); // in seconds
To set a new value to smooth, call setTargetValue.
yourValue.setTargetValue (newValue);
Once per sample in processBlock, call getNextValue to get your current smoothed value.
auto yourValueNow{ yourValue.getNextValue() };
If you need to jump many samples into the future, call skip. This effectively advances the smoother -you can’t go back.
auto yourValueAfter200Samples{ yourValue.skip (200) };
If you need to get the current value many times for each sample, call getNextValue only once, because it advances the smoother. Every subsequent time call getCurrentValue.
auto yourValueNowAgain{ yourValue.getCurrentValue() };
To know if you’re in the middle of a ramp, call isSmoothing(). To know the last target value (which may or not have been reached yet), call getTargetValue(). To make the smoother jump to a new value (that is, to bypass the smoothing), call setCurrentAndTargetValue (newValue). If your value represents a gain (an amplitude), you can advance it for a whole buffer and apply the smoothed gain to it calling applyGain(). There are three versions: for an AudioBuffer, for a pointer, and for two pointers (one for output, one for input).