Utility class for linearly smoothed values like volume etc. More...
#include <juce_LinearSmoothedValue.h>

Public Member Functions | |
| LinearSmoothedValue () noexcept | |
| Constructor. More... | |
| LinearSmoothedValue (FloatType initialValue) noexcept | |
| Constructor. More... | |
| void | applyGain (FloatType *samples, int numSamples) noexcept |
| Applies a linear smoothed gain to a stream of samples S[i] *= gain. More... | |
| void | applyGain (FloatType *samplesOut, const FloatType *samplesIn, int numSamples) noexcept |
| Computes output as linear smoothed gain applied to a stream of samples. More... | |
| void | applyGain (AudioBuffer< FloatType > &buffer, int numSamples) noexcept |
| Applies a linear smoothed gain to a buffer. More... | |
| FloatType | getNextValue () noexcept |
| Compute the next value. More... | |
| FloatType | getTargetValue () const noexcept |
| Returns the target value towards which the smoothed value is currently moving. More... | |
| bool | isSmoothing () const noexcept |
| Returns true if the current value is currently being interpolated. More... | |
| void | reset (double sampleRate, double rampLengthInSeconds) noexcept |
| Reset to a new sample rate and ramp length. More... | |
| void | setValue (FloatType newValue) noexcept |
| Set a new target value. More... | |
Private Attributes | |
| int | countdown = 0 |
| FloatType | currentValue = 0 |
| FloatType | step = 0 |
| int | stepsToTarget = 0 |
| FloatType | target = 0 |
Utility class for linearly smoothed values like volume etc.
that should not change abruptly but as a linear ramp, to avoid audio glitches.
|
inlinenoexcept |
Constructor.
|
inlinenoexcept |
Constructor.
|
inlinenoexcept |
Applies a linear smoothed gain to a stream of samples S[i] *= gain.
| samples | Pointer to a raw array of samples |
| numSamples | Length of array of samples |
References LinearSmoothedValue< FloatType >::getNextValue(), LinearSmoothedValue< FloatType >::isSmoothing(), jassert, FloatVectorOperations::multiply(), and LinearSmoothedValue< FloatType >::target.
|
inlinenoexcept |
Computes output as linear smoothed gain applied to a stream of samples.
Sout[i] = Sin[i] * gain
| samplesOut | A pointer to a raw array of output samples |
| samplesIn | A pointer to a raw array of input samples |
| numSamples | The length of the array of samples |
References LinearSmoothedValue< FloatType >::getNextValue(), LinearSmoothedValue< FloatType >::isSmoothing(), jassert, FloatVectorOperations::multiply(), and LinearSmoothedValue< FloatType >::target.
|
inlinenoexcept |
Applies a linear smoothed gain to a buffer.
References LinearSmoothedValue< FloatType >::getNextValue(), LinearSmoothedValue< FloatType >::isSmoothing(), jassert, and LinearSmoothedValue< FloatType >::target.
|
inlinenoexcept |
Compute the next value.
References LinearSmoothedValue< FloatType >::countdown, LinearSmoothedValue< FloatType >::currentValue, LinearSmoothedValue< FloatType >::step, and LinearSmoothedValue< FloatType >::target.
Referenced by LinearSmoothedValue< FloatType >::applyGain().
|
inlinenoexcept |
Returns the target value towards which the smoothed value is currently moving.
References LinearSmoothedValue< FloatType >::target.
|
inlinenoexcept |
Returns true if the current value is currently being interpolated.
References LinearSmoothedValue< FloatType >::countdown.
Referenced by LinearSmoothedValue< FloatType >::applyGain().
|
inlinenoexcept |
Reset to a new sample rate and ramp length.
| sampleRate | The sampling rate |
| rampLengthInSeconds | The duration of the ramp in seconds |
References LinearSmoothedValue< FloatType >::countdown, LinearSmoothedValue< FloatType >::currentValue, jassert, LinearSmoothedValue< FloatType >::stepsToTarget, and LinearSmoothedValue< FloatType >::target.
Referenced by Bias< FloatType >::updateRamp().
|
inlinenoexcept |
Set a new target value.
| newValue | New target value |
References LinearSmoothedValue< FloatType >::countdown, LinearSmoothedValue< FloatType >::currentValue, LinearSmoothedValue< FloatType >::step, LinearSmoothedValue< FloatType >::stepsToTarget, and LinearSmoothedValue< FloatType >::target.
|
private |
|
private |
|
private |
|
private |
|
private |