JUCE API reference
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Attributes | List of all members
juce::SmoothedValueBase< SmoothedValueType > Class Template Reference

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

Inheritance diagram for juce::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.
 
int getNumSamplesToReachTarget () const noexcept
 Returns the number of samples remaining to reach the target value.
 

Protected Attributes

FloatType currentValue = 0
 
FloatType target = currentValue
 
int countdown = 0
 

Detailed Description

template<typename SmoothedValueType>
class juce::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

Constructor & Destructor Documentation

◆ SmoothedValueBase()

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

Constructor.

Member Function Documentation

◆ isSmoothing()

bool juce::SmoothedValueBase< SmoothedValueType >::isSmoothing ( ) const
inlinenoexcept

◆ getCurrentValue()

FloatType juce::SmoothedValueBase< SmoothedValueType >::getCurrentValue ( ) const
inlinenoexcept

Returns the current value of the ramp.

References juce::SmoothedValueBase< SmoothedValueType >::currentValue.

◆ getTargetValue()

FloatType juce::SmoothedValueBase< SmoothedValueType >::getTargetValue ( ) const
inlinenoexcept

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

References juce::SmoothedValueBase< SmoothedValueType >::target.

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

◆ setCurrentAndTargetValue()

void juce::SmoothedValueBase< SmoothedValueType >::setCurrentAndTargetValue ( FloatType  newValue)
inline

◆ applyGain() [1/3]

void juce::SmoothedValueBase< SmoothedValueType >::applyGain ( FloatType *  samples,
int  numSamples 
)
inlinenoexcept

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

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

◆ applyGain() [2/3]

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

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

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

◆ applyGain() [3/3]

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

◆ getNumSamplesToReachTarget()

int juce::SmoothedValueBase< SmoothedValueType >::getNumSamplesToReachTarget ( ) const
inlinenoexcept

Returns the number of samples remaining to reach the target value.

References juce::SmoothedValueBase< SmoothedValueType >::countdown.

Member Data Documentation

◆ currentValue

◆ target

◆ countdown


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