JUCE

- Main Page
- Related Pages
- Topics
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Attributes | List of all members
SmoothedValueBase< SmoothedValueType > Class Template Reference
juce_audio_basics » utilities

A base class for the smoothed value classes. More...

`#include <juce_SmoothedValue.h>`

Inheritance diagram for SmoothedValueBase< SmoothedValueType >:

## 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

## Detailed Description

template<typename SmoothedValueType>
class SmoothedValueBase< SmoothedValueType >

A base class for the smoothed value classes.

This class is used to provide common functionality to the SmoothedValue and dsp::LogRampedValue classes.

## Member Typedef Documentation

## ◆ FloatType

template<typename SmoothedValueType >

using SmoothedValueBase< SmoothedValueType >::FloatType = typename FloatTypeHelper<SmoothedValueType>::Type

## Constructor & Destructor Documentation

## ◆ SmoothedValueBase()

template<typename SmoothedValueType >

SmoothedValueBase< SmoothedValueType >::SmoothedValueBase | ( |  | ) |
| default

Constructor.

## Member Function Documentation

## ◆ isSmoothing()

template<typename SmoothedValueType >

bool SmoothedValueBase< SmoothedValueType >::isSmoothing | ( |  | ) | const
| 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(), SmoothedValue< FloatType, SmoothingType >::getNextValue(), and juce::dsp::Oscillator< SampleType >::process().

## ◆ getCurrentValue()

template<typename SmoothedValueType >

FloatType SmoothedValueBase< SmoothedValueType >::getCurrentValue | ( |  | ) | const
| noexcept

Returns the current value of the ramp.

References SmoothedValueBase< SmoothedValueType >::currentValue.

## ◆ getTargetValue()

template<typename SmoothedValueType >

FloatType SmoothedValueBase< SmoothedValueType >::getTargetValue | ( |  | ) | const
| noexcept

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

References SmoothedValueBase< SmoothedValueType >::target.

Referenced by juce::dsp::Oscillator< SampleType >::getFrequency().

## ◆ setCurrentAndTargetValue()

template<typename SmoothedValueType >

void SmoothedValueBase< SmoothedValueType >::setCurrentAndTargetValue | ( | FloatType | newValue | ) |

Sets the current value and the target value.

Parameters

  newValue | the new value to take

References SmoothedValueBase< SmoothedValueType >::countdown, SmoothedValueBase< SmoothedValueType >::currentValue, and SmoothedValueBase< SmoothedValueType >::target.

Referenced by SmoothedValue< FloatType, SmoothingType >::reset(), juce::dsp::Oscillator< SampleType >::setFrequency(), SmoothedValue< FloatType, SmoothingType >::setTargetValue(), and SmoothedValue< FloatType, SmoothingType >::skip().

## ◆ applyGain() [1/3]

template<typename SmoothedValueType >

void SmoothedValueBase< SmoothedValueType >::applyGain | ( | FloatType * | samples,
|  | int | numSamples )
| noexcept

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

Parameters

  samples | Pointer to a raw array of samples
  numSamples | Length of array of samples

References SmoothedValueBase< SmoothedValueType >::isSmoothing(), jassert, and SmoothedValueBase< SmoothedValueType >::target.

## ◆ applyGain() [2/3]

template<typename SmoothedValueType >

void SmoothedValueBase< SmoothedValueType >::applyGain | ( | FloatType * | samplesOut,
|  | const FloatType * | samplesIn,
|  | int | numSamples )
| noexcept

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

Sout[i] = Sin[i] * gain

Parameters

  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.

## ◆ applyGain() [3/3]

template<typename SmoothedValueType >

void SmoothedValueBase< SmoothedValueType >::applyGain | ( | AudioBuffer< FloatType > & | buffer,
|  | int | numSamples )
| noexcept

Applies a smoothed gain to a buffer.

References SmoothedValueBase< SmoothedValueType >::isSmoothing(), jassert, and SmoothedValueBase< SmoothedValueType >::target.

## Member Data Documentation

## ◆ currentValue

template<typename SmoothedValueType >

FloatType SmoothedValueBase< SmoothedValueType >::currentValue = 0
| protected

Referenced by SmoothedValueBase< SmoothedValueType >::getCurrentValue(), SmoothedValue< FloatType, SmoothingType >::getNextValue(), SmoothedValueBase< SmoothedValueType >::setCurrentAndTargetValue(), SmoothedValue< FloatType, SmoothingType >::skip(), and SmoothedValue< FloatType, SmoothingType >::SmoothedValue().

## ◆ target

template<typename SmoothedValueType >

FloatType SmoothedValueBase< SmoothedValueType >::target = currentValue
| protected

Referenced by SmoothedValueBase< SmoothedValueType >::applyGain(), SmoothedValueBase< SmoothedValueType >::applyGain(), SmoothedValueBase< SmoothedValueType >::applyGain(), SmoothedValue< FloatType, SmoothingType >::getNextValue(), SmoothedValueBase< SmoothedValueType >::getTargetValue(), SmoothedValue< FloatType, SmoothingType >::reset(), SmoothedValueBase< SmoothedValueType >::setCurrentAndTargetValue(), SmoothedValue< FloatType, SmoothingType >::setTargetValue(), SmoothedValue< FloatType, SmoothingType >::skip(), and SmoothedValue< FloatType, SmoothingType >::SmoothedValue().

## ◆ countdown

template<typename SmoothedValueType >

int SmoothedValueBase< SmoothedValueType >::countdown = 0
| protected

Referenced by SmoothedValue< FloatType, SmoothingType >::getNextValue(), SmoothedValueBase< SmoothedValueType >::isSmoothing(), SmoothedValueBase< SmoothedValueType >::setCurrentAndTargetValue(), SmoothedValue< FloatType, SmoothingType >::setTargetValue(), and SmoothedValue< FloatType, SmoothingType >::skip().

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

- juce_SmoothedValue.h