JUCE
Public Types | Public Member Functions | Protected Attributes | List of all members
SmoothedValueBase< SmoothedValueType > Class Template Reference

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

Public Types

using FloatType = typename FloatTypeHelper< SmoothedValueType >::Type
 

Public Member Functions

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

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.

◆ ~SmoothedValueBase()

template<typename SmoothedValueType>
virtual SmoothedValueBase< SmoothedValueType >::~SmoothedValueBase ( )
virtual

Member Function Documentation

◆ isSmoothing()

template<typename SmoothedValueType>
bool SmoothedValueBase< SmoothedValueType >::isSmoothing ( ) const
noexcept

◆ getCurrentValue()

template<typename SmoothedValueType>
FloatType SmoothedValueBase< SmoothedValueType >::getCurrentValue ( ) const
noexcept

Returns the current value of the ramp.

◆ getTargetValue()

template<typename SmoothedValueType>
FloatType SmoothedValueBase< SmoothedValueType >::getTargetValue ( ) const
noexcept

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

Referenced by dsp::Bias< FloatType >::getBias(), dsp::Oscillator< SampleType >::getFrequency(), and dsp::Gain< FloatType >::getGainLinear().

◆ setCurrentAndTargetValue()

template<typename SmoothedValueType>
void SmoothedValueBase< SmoothedValueType >::setCurrentAndTargetValue ( FloatType  newValue)

Sets the current value and the target value.

Parameters
newValuethe new value to take

Referenced by SmoothedValue< Type >::reset(), dsp::Oscillator< SampleType >::setFrequency(), SmoothedValue< Type >::setTargetValue(), and SmoothedValue< Type >::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
samplesPointer to a raw array of samples
numSamplesLength of array of samples

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

◆ applyGain() [3/3]

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

Applies a smoothed gain to a buffer.

Member Data Documentation

◆ currentValue

template<typename SmoothedValueType>
FloatType SmoothedValueBase< SmoothedValueType >::currentValue = 0
protected

◆ target

template<typename SmoothedValueType>
FloatType SmoothedValueBase< SmoothedValueType >::target = currentValue
protected

◆ countdown

template<typename SmoothedValueType>
int SmoothedValueBase< SmoothedValueType >::countdown = 0
protected

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