From a5ec5385967d3358ad5a98a30e2738e9f4b271fc Mon Sep 17 00:00:00 2001 From: jules Date: Mon, 21 Mar 2016 09:12:36 +0000 Subject: [PATCH] Added a couple of methods to LinearSmoothedValue --- .../effects/juce_LinearSmoothedValue.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/modules/juce_audio_basics/effects/juce_LinearSmoothedValue.h b/modules/juce_audio_basics/effects/juce_LinearSmoothedValue.h index 818ddb8e5c..544d2a2b4e 100644 --- a/modules/juce_audio_basics/effects/juce_LinearSmoothedValue.h +++ b/modules/juce_audio_basics/effects/juce_LinearSmoothedValue.h @@ -59,7 +59,6 @@ public: countdown = 0; } - //============================================================================== /** Set a new target value. */ void setValue (FloatType newValue) noexcept { @@ -75,7 +74,6 @@ public: } } - //============================================================================== /** Compute the next value. */ FloatType getNextValue() noexcept { @@ -87,6 +85,18 @@ public: return currentValue; } + /** Returns true if the current value is currently being interpolated. */ + bool isSmoothing() const noexcept + { + return countdown > 0; + } + + /** Returns the target value towards which the smoothed value is currently moving. */ + FloatType getTargetValue() const noexcept + { + return target; + } + private: //============================================================================== FloatType currentValue, target, step;