diff --git a/modules/juce_audio_basics/effects/juce_LinearSmoothedValue.h b/modules/juce_audio_basics/effects/juce_LinearSmoothedValue.h index 80dd6fc09e..e586f92e77 100644 --- a/modules/juce_audio_basics/effects/juce_LinearSmoothedValue.h +++ b/modules/juce_audio_basics/effects/juce_LinearSmoothedValue.h @@ -164,16 +164,16 @@ public: { if (buffer.getNumChannels() == 1) { - FloatType* samples = buffer.getWritePointer(0); + auto samples = buffer.getWritePointer(0); - for (int i = 0; i < numSamples; i++) + for (int i = 0; i < numSamples; ++i) samples[i] *= getNextValue(); } else { - for (int i = 0; i < numSamples; i++) + for (int i = 0; i < numSamples; ++i) { - const FloatType gain = getNextValue(); + auto gain = getNextValue(); for (int channel = 0; channel < buffer.getNumChannels(); channel++) buffer.setSample (channel, i, buffer.getSample (channel, i) * gain); @@ -188,22 +188,22 @@ public: //============================================================================== /** Skip the next numSamples samples. - - This is identical to calling getNextValue numSamples times. + This is identical to calling getNextValue numSamples times. It returns + the new current value. @see getNextValue */ - void skip (int numSamples) noexcept + FloatType skip (int numSamples) noexcept { if (numSamples >= countdown) { currentValue = target; countdown = 0; + return target; } - else - { - currentValue += (step * static_cast (numSamples)); - countdown -= numSamples; - } + + currentValue += (step * static_cast (numSamples)); + countdown -= numSamples; + return currentValue; } private: