dsp::LogRampedValue< FloatType > Class Template Reference
juce_dsp » maths

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

Inheritance diagram for dsp::LogRampedValue< FloatType >:

## Public Member Functions

| LogRampedValue ()=default
| Constructor. More...
| LogRampedValue (FloatType initialValue) noexcept
| Constructor. More...
void | setLogParameters (FloatType midPointAmplitudedB, bool rateOfChangeShouldIncrease) noexcept
| Sets the behaviour of the log ramp. 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 | setTargetValue (FloatType newValue) noexcept
| Set a new target value. More...
FloatType | getNextValue () noexcept
| Compute the next value. More...
FloatType | skip (int numSamples) noexcept
| Skip the next numSamples samples. More...
Public Member Functions inherited from SmoothedValueBase< LogRampedValue< FloatType > >
| SmoothedValueBase ()=default
| Constructor. More...
virtual | ~SmoothedValueBase ()
bool | isSmoothing () const noexcept
| Returns true if the current value is currently being interpolated. More...
FloatType | getCurrentValue () const noexcept
| Returns the current value of the ramp. More...
FloatType | getTargetValue () const noexcept
| Returns the target value towards which the smoothed value is currently moving. More...
void | setCurrentAndTargetValue (FloatType newValue)
| Sets the current value and the target value. 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...
void | applyGain (AudioBuffer< FloatType > &buffer, int numSamples) noexcept
| Applies a smoothed gain to a buffer. More...

## Additional Inherited Members

Public Types inherited from SmoothedValueBase< LogRampedValue< FloatType > >
using | FloatType = typename FloatTypeHelper< LogRampedValue< FloatType > >::Type
Protected Attributes inherited from SmoothedValueBase< LogRampedValue< FloatType > >
FloatType | currentValue
FloatType | target
int | countdown

## Detailed Description

### template<typename FloatType>
class 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

## Constructor & Destructor Documentation

## LogRampedValue() [1/2]

template<typename FloatType >

dsp::LogRampedValue< FloatType >::LogRampedValue | ( |  | ) |

default

Constructor.

## LogRampedValue() [2/2]

template<typename FloatType >

dsp::LogRampedValue< FloatType >::LogRampedValue | ( | FloatType | initialValue | ) |

noexcept

Constructor.

References SmoothedValueBase< LogRampedValue< FloatType > >::currentValue, and SmoothedValueBase< LogRampedValue< FloatType > >::target.

## Member Function Documentation

## setLogParameters()

template<typename FloatType >

void dsp::LogRampedValue< FloatType >::setLogParameters | ( | FloatType | midPointAmplitudedB,
|  | bool | rateOfChangeShouldIncrease
| ) |  |

noexcept

Sets the behaviour of the log ramp.

Parameters

  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 Decibels::decibelsToGain(), and jassert.

## reset() [1/2]

template<typename FloatType >

void dsp::LogRampedValue< FloatType >::reset | ( | double | sampleRate,
|  | double | rampLengthInSeconds
| ) |  |

noexcept

Reset to a new sample rate and ramp length.

Parameters

  sampleRate | The sample rate
  rampLengthInSeconds | The duration of the ramp in seconds

References jassert.

## reset() [2/2]

template<typename FloatType >

void dsp::LogRampedValue< FloatType >::reset | ( | int | numSteps | ) |

noexcept

Set a new ramp length directly in samples.

Parameters

  numSteps | The number of samples over which the ramp should be active

References SmoothedValueBase< LogRampedValue< FloatType > >::setCurrentAndTargetValue(), and SmoothedValueBase< LogRampedValue< FloatType > >::target.

## setTargetValue()

template<typename FloatType >

void dsp::LogRampedValue< FloatType >::setTargetValue | ( | FloatType | newValue | ) |

noexcept

Set a new target value.

Parameters

  newValue | The new target value

References SmoothedValueBase< LogRampedValue< FloatType > >::countdown, SmoothedValueBase< LogRampedValue< FloatType > >::currentValue, SmoothedValueBase< LogRampedValue< FloatType > >::setCurrentAndTargetValue(), and SmoothedValueBase< LogRampedValue< FloatType > >::target.

## getNextValue()

template<typename FloatType >

FloatType dsp::LogRampedValue< FloatType >::getNextValue | ( |  | ) |

noexcept

Compute the next value.

Returns
  Smoothed value

References SmoothedValueBase< LogRampedValue< FloatType > >::countdown, SmoothedValueBase< LogRampedValue< FloatType > >::currentValue, SmoothedValueBase< LogRampedValue< FloatType > >::isSmoothing(), jmap(), and SmoothedValueBase< LogRampedValue< FloatType > >::target.

## skip()

template<typename FloatType >

FloatType dsp::LogRampedValue< FloatType >::skip | ( | int | numSamples | ) |

noexcept

Skip the next numSamples samples.

This is identical to calling getNextValue numSamples times.

See also
  getNextValue

References SmoothedValueBase< LogRampedValue< FloatType > >::countdown, SmoothedValueBase< LogRampedValue< FloatType > >::currentValue, jmap(), SmoothedValueBase< LogRampedValue< FloatType > >::setCurrentAndTargetValue(), and SmoothedValueBase< LogRampedValue< FloatType > >::target.

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

- juce_LogRampedValue.h