JUCE  v6.1.6 (6.0.8-1114)
JUCE API
Looking for a senior C++ dev?
I'm looking for work. Hire me!
juce::dsp::LogRampedValue< FloatType > Class Template Reference

Utility class for logarithmically smoothed linear values. More...

#include <juce_LogRampedValue.h>

Inheritance diagram for juce::dsp::LogRampedValue< FloatType >:
Collaboration diagram for juce::dsp::LogRampedValue< FloatType >:

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
 

Detailed Description

template<typename FloatType>
class juce::dsp::LogRampedValue< FloatType >

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.

See also
SmoothedValue

@tags{DSP}

Member Typedef Documentation

◆ FloatType

using juce::SmoothedValueBase< LogRampedValue< FloatType > >::FloatType = typename FloatTypeHelper<LogRampedValue< FloatType > >::Type
inherited

Constructor & Destructor Documentation

◆ LogRampedValue() [1/2]

template<typename FloatType >
juce::dsp::LogRampedValue< FloatType >::LogRampedValue ( )
default

Constructor.

◆ LogRampedValue() [2/2]

Member Function Documentation

◆ applyGain() [1/3]

void juce::SmoothedValueBase< LogRampedValue< FloatType > >::applyGain ( AudioBuffer< FloatType > &  buffer,
int  numSamples 
)
inlinenoexceptinherited

Applies a smoothed gain to a buffer.

◆ applyGain() [2/3]

void juce::SmoothedValueBase< LogRampedValue< FloatType > >::applyGain ( FloatType samples,
int  numSamples 
)
inlinenoexceptinherited

Applies a smoothed gain to a stream of samples S[i] *= gain.

Parameters
samplesPointer to a raw array of samples
numSamplesLength of array of samples

◆ applyGain() [3/3]

void juce::SmoothedValueBase< LogRampedValue< FloatType > >::applyGain ( FloatType samplesOut,
const FloatType samplesIn,
int  numSamples 
)
inlinenoexceptinherited

Computes output as a smoothed gain applied to a stream of samples.

Sout[i] = Sin[i] * gain

Parameters
samplesOutA pointer to a raw array of output samples
samplesInA pointer to a raw array of input samples
numSamplesThe length of the array of samples

◆ getCurrentValue()

FloatType juce::SmoothedValueBase< LogRampedValue< FloatType > >::getCurrentValue
inlinenoexceptinherited

Returns the current value of the ramp.

◆ getNextSmoothedValue()

FloatType juce::SmoothedValueBase< LogRampedValue< FloatType > >::getNextSmoothedValue
inlineprivatenoexceptinherited

◆ getNextValue()

◆ getTargetValue()

FloatType juce::SmoothedValueBase< LogRampedValue< FloatType > >::getTargetValue
inlinenoexceptinherited

Returns the target value towards which the smoothed value is currently moving.

◆ isSmoothing()

bool juce::SmoothedValueBase< LogRampedValue< FloatType > >::isSmoothing
inlinenoexceptinherited

Returns true if the current value is currently being interpolated.

◆ reset() [1/2]

template<typename FloatType >
void juce::dsp::LogRampedValue< FloatType >::reset ( double  sampleRate,
double  rampLengthInSeconds 
)
inlinenoexcept

Reset to a new sample rate and ramp length.

Parameters
sampleRateThe sample rate
rampLengthInSecondsThe duration of the ramp in seconds

References jassert.

◆ reset() [2/2]

template<typename FloatType >
void juce::dsp::LogRampedValue< FloatType >::reset ( int  numSteps)
inlinenoexcept

◆ setCurrentAndTargetValue()

void juce::SmoothedValueBase< LogRampedValue< FloatType > >::setCurrentAndTargetValue ( FloatType  newValue)
inlineinherited

Sets the current value and the target value.

Parameters
newValuethe new value to take

◆ setLogParameters()

template<typename FloatType >
void juce::dsp::LogRampedValue< FloatType >::setLogParameters ( FloatType  midPointAmplitudedB,
bool  rateOfChangeShouldIncrease 
)
inlinenoexcept

Sets the behaviour of the log ramp.

Parameters
midPointAmplitudedBSets the amplitude of the mid point in decibels, with the target value at 0 dB and the initial value at -inf dB
rateOfChangeShouldIncreaseIf 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.

◆ setTargetValue()

◆ skip()

◆ updateRampParameters()

Member Data Documentation

◆ B

◆ countdown

int juce::SmoothedValueBase< LogRampedValue< FloatType > >::countdown
protectedinherited

◆ currentValue

FloatType juce::SmoothedValueBase< LogRampedValue< FloatType > >::currentValue
protectedinherited

◆ d

◆ increasingRateOfChange

◆ r

◆ source

◆ stepsToTarget

◆ target

FloatType juce::SmoothedValueBase< LogRampedValue< FloatType > >::target
protectedinherited

◆ temp


The documentation for this class was generated from the following file: