OpenShot Audio Library | OpenShotAudio 0.3.2
|
#include <juce_SmoothedValue.h>
Public Types | |
template<typename T > | |
using | MultiplicativeVoid = (void setValue(FloatType newValue, bool force=false) noexcept, { if(force) { this->setCurrentAndTargetValue(newValue);return;} setTargetValue(newValue);}) private typename std::enable_if< std::is_same< T, ValueSmoothingTypes::Multiplicative >::value, void >::type |
![]() | |
using | FloatType = typename FloatTypeHelper< SmoothedValueType >::Type |
Public Attributes | |
FloatType | step = FloatType() |
int | stepsToTarget = 0 |
Additional Inherited Members | |
![]() | |
FloatType | currentValue = 0 |
FloatType | target = currentValue |
int | countdown = 0 |
A utility class for values that need smoothing to avoid audio glitches.
A ValueSmoothingTypes::Linear template parameter selects linear smoothing, which increments the SmoothedValue linearly towards its target value.
A ValueSmoothingTypes::Multiplicative template parameter selects multiplicative smoothing increments towards the target value.
Multiplicative smoothing is useful when you are dealing with exponential/logarithmic values like volume in dB or frequency in Hz. For example a 12 step ramp from 440.0 Hz (A4) to 880.0 Hz (A5) will increase the frequency with an equal temperament tuning across the octave. A 10 step smoothing from 1.0 (0 dB) to 3.16228 (10 dB) will increase the value in increments of 1 dB.
Note that when you are using multiplicative smoothing you cannot ever reach a target value of zero!
Definition at line 228 of file juce_SmoothedValue.h.
using juce::SmoothedValue< FloatType, SmoothingType >::MultiplicativeVoid = (void setValue (FloatType newValue, bool force = false) noexcept, { if (force) { this->setCurrentAndTargetValue (newValue); return; } setTargetValue (newValue); }) private typename std::enable_if <std::is_same <T, ValueSmoothingTypes::Multiplicative>::value, void>::type |
THIS FUNCTION IS DEPRECATED.
Use setTargetValue (float)
and setCurrentAndTargetValue()
instead:
lsv.setValue (x, false); -> lsv.setTargetValue (x); lsv.setValue (x, true); -> lsv.setCurrentAndTargetValue (x);
newValue | The new target value |
force | If true, the value will be set immediately, bypassing the ramp |
Definition at line 360 of file juce_SmoothedValue.h.
|
inlinenoexcept |
Constructor.
Definition at line 233 of file juce_SmoothedValue.h.
|
inlinenoexcept |
Constructor.
Definition at line 239 of file juce_SmoothedValue.h.
|
inlinenoexcept |
Compute the next value.
Definition at line 297 of file juce_SmoothedValue.h.
Referenced by juce::dsp::Oscillator< SampleType >::process(), juce::Reverb::processMono(), juce::dsp::Oscillator< SampleType >::processSample(), and juce::Reverb::processStereo().
|
inlinenoexcept |
Reset to a new sample rate and ramp length.
sampleRate | The sample rate |
rampLengthInSeconds | The duration of the ramp in seconds |
Definition at line 254 of file juce_SmoothedValue.h.
Referenced by juce::dsp::Convolution::prepare(), juce::dsp::Oscillator< SampleType >::reset(), juce::SmoothedValue< FloatType, SmoothingType >::reset(), and juce::Reverb::setSampleRate().
|
inlinenoexcept |
Set a new ramp length directly in samples.
numSteps | The number of samples over which the ramp should be active |
Definition at line 263 of file juce_SmoothedValue.h.
|
inlinenoexcept |
Definition at line 377 of file juce_SmoothedValue.h.
|
inlinenoexcept |
Definition at line 383 of file juce_SmoothedValue.h.
|
inline |
Definition at line 370 of file juce_SmoothedValue.h.
|
inlinenoexcept |
Definition at line 364 of file juce_SmoothedValue.h.
|
inlinenoexcept |
Set the next value to ramp towards.
newValue | The new target value |
Definition at line 273 of file juce_SmoothedValue.h.
Referenced by juce::dsp::Oscillator< SampleType >::setFrequency(), and juce::Reverb::setParameters().
|
inlinenoexcept |
Skip the next numSamples samples. This is identical to calling getNextValue numSamples times. It returns the new current value.
Definition at line 318 of file juce_SmoothedValue.h.
Referenced by juce::dsp::Oscillator< SampleType >::process().
|
inline |
Definition at line 396 of file juce_SmoothedValue.h.
|
inlinenoexcept |
Definition at line 390 of file juce_SmoothedValue.h.
FloatType juce::SmoothedValue< FloatType, SmoothingType >::step = FloatType() |
Definition at line 402 of file juce_SmoothedValue.h.
int juce::SmoothedValue< FloatType, SmoothingType >::stepsToTarget = 0 |
Definition at line 403 of file juce_SmoothedValue.h.