Loading...
Searching...
No Matches
juce::SmoothedValueBase< SmoothedValueType > Class Template Reference

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.

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

Member Typedef Documentation

◆ FloatType

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

Constructors and Destructors

◆ SmoothedValueBase()

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

Constructor.

Member Functions

◆ isSmoothing()

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

Returns true if the current value is currently being interpolated.

References countdown.

Referenced by applyGain(), applyGain(), and applyGain().

◆ getCurrentValue()

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

Returns the current value of the ramp.

References currentValue.

◆ getTargetValue()

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

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

References target.

◆ setCurrentAndTargetValue()

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

Sets the current value and the target value.

Parameters
newValuethe new value to take

References countdown, currentValue, and target.

◆ applyGain() [1/3]

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

References isSmoothing(), and target.

◆ applyGain() [2/3]

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

References isSmoothing(), and target.

◆ applyGain() [3/3]

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

Applies a smoothed gain to a buffer.

References isSmoothing(), and target.

Member Data Documentation

◆ currentValue

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

◆ target

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

◆ countdown

template<typename SmoothedValueType>
int juce::SmoothedValueBase< SmoothedValueType >::countdown = 0
protected
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram