Utility class for logarithmically smoothed linear values. More...
#include <juce_LogRampedValue.h>
Public Types | |
using | FloatType = typename FloatTypeHelper< LogRampedValue< FloatType > >::Type |
Public Member Functions | |
LogRampedValue ()=default | |
Constructor. More... | |
LogRampedValue (FloatType initialValue) noexcept | |
Constructor. More... | |
void | applyGain (AudioBuffer< FloatType > &buffer, int numSamples) noexcept |
Applies a smoothed gain to a buffer. More... | |
void | applyGain (FloatType *samples, int numSamples) noexcept |
Applies a smoothed gain to a stream of samples S[i] *= gain. More... | |
void | applyGain (FloatType *samplesOut, const FloatType *samplesIn, int numSamples) noexcept |
Computes output as a smoothed gain applied to a stream of samples. More... | |
FloatType | getCurrentValue () const noexcept |
Returns the current value of the ramp. 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 | reset (int numSteps) noexcept |
Set a new ramp length directly in samples. More... | |
void | setCurrentAndTargetValue (FloatType newValue) |
Sets the current value and the target value. More... | |
void | setLogParameters (FloatType midPointAmplitudedB, bool rateOfChangeShouldIncrease) noexcept |
Sets the behaviour of the log ramp. More... | |
void | setTargetValue (FloatType newValue) noexcept |
Set a new target value. More... | |
FloatType | skip (int numSamples) noexcept |
Skip the next numSamples samples. More... | |
Protected Attributes | |
int | countdown |
FloatType | currentValue |
FloatType | target |
Private Member Functions | |
FloatType | getNextSmoothedValue () noexcept |
void | updateRampParameters () |
Private Attributes | |
FloatType | B = Decibels::decibelsToGain ((FloatType) -40) |
FloatType | d = 1 |
bool | increasingRateOfChange = true |
FloatType | r = 0 |
FloatType | source = 0 |
int | stepsToTarget = 0 |
FloatType | temp = 0 |
Utility class for logarithmically smoothed linear values.
Logarithmically smoothed values can be more relevant than linear ones for specific cases such as algorithm change smoothing, using two of them in opposite directions.
The gradient of the logarithmic/exponential slope can be configured by calling LogRampedValue::setLogParameters.
@tags{DSP}
|
inherited |
|
default |
Constructor.
|
inlinenoexcept |
|
inlinenoexceptinherited |
Applies a smoothed gain to a buffer.
|
inlinenoexceptinherited |
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 |
|
inlinenoexceptinherited |
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 |
|
inlinenoexceptinherited |
Returns the current value of the ramp.
|
inlineprivatenoexceptinherited |
|
inlinenoexcept |
Compute the next value.
References juce::SmoothedValueBase< LogRampedValue< FloatType > >::countdown, juce::SmoothedValueBase< LogRampedValue< FloatType > >::currentValue, juce::dsp::LogRampedValue< FloatType >::d, juce::SmoothedValueBase< LogRampedValue< FloatType > >::isSmoothing(), juce::jmap(), juce::dsp::LogRampedValue< FloatType >::r, juce::dsp::LogRampedValue< FloatType >::source, juce::SmoothedValueBase< LogRampedValue< FloatType > >::target, and juce::dsp::LogRampedValue< FloatType >::temp.
|
inlinenoexceptinherited |
Returns the target value towards which the smoothed value is currently moving.
|
inlinenoexceptinherited |
Returns true if the current value is currently being interpolated.
|
inlinenoexcept |
Reset to a new sample rate and ramp length.
sampleRate | The sample rate |
rampLengthInSeconds | The duration of the ramp in seconds |
References jassert.
|
inlinenoexcept |
Set a new ramp length directly in samples.
numSteps | The number of samples over which the ramp should be active |
References juce::SmoothedValueBase< LogRampedValue< FloatType > >::setCurrentAndTargetValue(), juce::dsp::LogRampedValue< FloatType >::stepsToTarget, juce::SmoothedValueBase< LogRampedValue< FloatType > >::target, and juce::dsp::LogRampedValue< FloatType >::updateRampParameters().
|
inlineinherited |
Sets the current value and the target value.
newValue | the new value to take |
|
inlinenoexcept |
Sets the behaviour of the log ramp.
midPointAmplitudedB | Sets the amplitude of the mid point in decibels, with the target value at 0 dB and the initial value at -inf dB |
rateOfChangeShouldIncrease | If true then the ramp starts shallow and gets progressively steeper, if false then the ramp is initially steep and flattens out as you approach the target value |
References juce::dsp::LogRampedValue< FloatType >::B, juce::Decibels::decibelsToGain(), juce::dsp::LogRampedValue< FloatType >::increasingRateOfChange, and jassert.
|
inlinenoexcept |
Set a new target value.
newValue | The new target value |
References juce::SmoothedValueBase< LogRampedValue< FloatType > >::countdown, juce::SmoothedValueBase< LogRampedValue< FloatType > >::currentValue, juce::SmoothedValueBase< LogRampedValue< FloatType > >::setCurrentAndTargetValue(), juce::dsp::LogRampedValue< FloatType >::source, juce::dsp::LogRampedValue< FloatType >::stepsToTarget, juce::SmoothedValueBase< LogRampedValue< FloatType > >::target, and juce::dsp::LogRampedValue< FloatType >::updateRampParameters().
|
inlinenoexcept |
Skip the next numSamples samples.
This is identical to calling getNextValue numSamples times.
References juce::SmoothedValueBase< LogRampedValue< FloatType > >::countdown, juce::SmoothedValueBase< LogRampedValue< FloatType > >::currentValue, juce::dsp::LogRampedValue< FloatType >::d, juce::jmap(), juce::dsp::LogRampedValue< FloatType >::r, juce::SmoothedValueBase< LogRampedValue< FloatType > >::setCurrentAndTargetValue(), juce::dsp::LogRampedValue< FloatType >::source, juce::SmoothedValueBase< LogRampedValue< FloatType > >::target, and juce::dsp::LogRampedValue< FloatType >::temp.
|
inlineprivate |
References juce::dsp::LogRampedValue< FloatType >::B, juce::dsp::LogRampedValue< FloatType >::d, juce::dsp::LogRampedValue< FloatType >::increasingRateOfChange, juce::dsp::LogRampedValue< FloatType >::r, juce::dsp::LogRampedValue< FloatType >::stepsToTarget, and juce::dsp::LogRampedValue< FloatType >::temp.
Referenced by juce::dsp::LogRampedValue< FloatType >::reset(), and juce::dsp::LogRampedValue< FloatType >::setTargetValue().
|
private |
|
protectedinherited |
|
protectedinherited |
|
private |
|
private |
|
private |
|
private |
|
private |
|
protectedinherited |
|
private |