SmoothedValue overshoot issue

Not sure if this is a bug or more of a known issue, but I don’t see it mentioned anywhere:

SmoothedValue in linear smoothing mode returns values from getNextValue() that overshoot the value given in setTargetValue().

To see this, paste the following into juce_SmoothedValue.h at line 308:

    if (step > 0 && this->currentValue > this->target)
        DBG ("SmoothedValue overshoot warning: currentValue went over target. "
             + String (this->currentValue, 7) + " > " + String (this->target, 7));
    
    if (step < 0 && this->currentValue < this->target)
        DBG ("SmoothedValue overshoot warning: currentValue went under target. "
             + String (this->currentValue, 7) + " < " + String (this->target, 7));

Then observe the DBG output as you rapidly move a Slider attached to a Parameter (this would be in the context of what I’d consider typical usage - where setTargetValue is called once at the top of each processBlock, and then getNextValue is called in the per-sample loop therein.)

In practice, this can be especially problematic at the far limits of Slider movement. It results in SmoothedValue returning values that exceed the Parameter’s given range.

This is probably due to a rounding error… I had been using SmoothedValue templated for float (since that’s what AudioProcessorValueTreeState gives). I tried changing to SmoothedValue templated for double, and that seems to stop the overshoot.