A base class for the smoothed value classes. More...
#include <juce_SmoothedValue.h>
Public Types | |
using | FloatType = typename FloatTypeHelper<SmoothedValueType>::Type |
Public Member Functions | |
SmoothedValueBase ()=default | |
Constructor. | |
bool | isSmoothing () const noexcept |
Returns true if the current value is currently being interpolated. | |
FloatType | getCurrentValue () const noexcept |
Returns the current value of the ramp. | |
FloatType | getTargetValue () const noexcept |
Returns the target value towards which the smoothed value is currently moving. | |
void | setCurrentAndTargetValue (FloatType newValue) |
Sets the current value and the target value. | |
void | applyGain (FloatType *samples, int numSamples) noexcept |
Applies a smoothed gain to a stream of samples S[i] *= gain. | |
void | applyGain (FloatType *samplesOut, const FloatType *samplesIn, int numSamples) noexcept |
Computes output as a smoothed gain applied to a stream of samples. | |
void | applyGain (AudioBuffer< FloatType > &buffer, int numSamples) noexcept |
Applies a smoothed gain to a buffer. | |
Protected Attributes | |
FloatType | currentValue = 0 |
FloatType | target = currentValue |
int | countdown = 0 |
A base class for the smoothed value classes.
This class is used to provide common functionality to the SmoothedValue and dsp::LogRampedValue classes.
using SmoothedValueBase< SmoothedValueType >::FloatType = typename FloatTypeHelper<SmoothedValueType>::Type |
|
default |
Constructor.
|
noexcept |
Returns true if the current value is currently being interpolated.
References SmoothedValueBase< SmoothedValueType >::countdown.
Referenced by SmoothedValueBase< SmoothedValueType >::applyGain(), SmoothedValueBase< SmoothedValueType >::applyGain(), SmoothedValueBase< SmoothedValueType >::applyGain(), and dsp::Oscillator< SampleType >::process().
|
noexcept |
Returns the current value of the ramp.
References SmoothedValueBase< SmoothedValueType >::currentValue.
|
noexcept |
Returns the target value towards which the smoothed value is currently moving.
References SmoothedValueBase< SmoothedValueType >::target.
Referenced by dsp::Oscillator< SampleType >::getFrequency().
void SmoothedValueBase< SmoothedValueType >::setCurrentAndTargetValue | ( | FloatType | newValue | ) |
Sets the current value and the target value.
newValue | the new value to take |
References SmoothedValueBase< SmoothedValueType >::countdown, SmoothedValueBase< SmoothedValueType >::currentValue, and SmoothedValueBase< SmoothedValueType >::target.
Referenced by dsp::Oscillator< SampleType >::setFrequency().
|
noexcept |
Applies a 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 SmoothedValueBase< SmoothedValueType >::isSmoothing(), jassert, and SmoothedValueBase< SmoothedValueType >::target.
|
noexcept |
Computes output as a 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 SmoothedValueBase< SmoothedValueType >::isSmoothing(), jassert, and SmoothedValueBase< SmoothedValueType >::target.
|
noexcept |
Applies a smoothed gain to a buffer.
References SmoothedValueBase< SmoothedValueType >::isSmoothing(), jassert, and SmoothedValueBase< SmoothedValueType >::target.
|
protected |
|
protected |
Referenced by SmoothedValueBase< SmoothedValueType >::applyGain(), SmoothedValueBase< SmoothedValueType >::applyGain(), SmoothedValueBase< SmoothedValueType >::applyGain(), SmoothedValueBase< SmoothedValueType >::getTargetValue(), and SmoothedValueBase< SmoothedValueType >::setCurrentAndTargetValue().
|
protected |