JUCE
Public Member Functions | List of all members
dsp::Gain< FloatType > Class Template Reference

Applies a gain to audio samples as single samples or AudioBlocks. More...

Public Member Functions

 Gain () noexcept=default
 
void setGainLinear (FloatType newGain) noexcept
 Applies a new gain as a linear value. More...
 
void setGainDecibels (FloatType newGainDecibels) noexcept
 Applies a new gain as a decibel value. More...
 
FloatType getGainLinear () const noexcept
 Returns the current gain as a linear value. More...
 
FloatType getGainDecibels () const noexcept
 Returns the current gain in decibels. More...
 
void setRampDurationSeconds (double newDurationSeconds) noexcept
 Sets the length of the ramp used for smoothing gain changes. More...
 
double getRampDurationSeconds () const noexcept
 Returns the ramp duration in seconds. More...
 
bool isSmoothing () const noexcept
 Returns true if the current value is currently being interpolated. More...
 
void prepare (const ProcessSpec &spec) noexcept
 Called before processing starts. More...
 
void reset () noexcept
 Resets the internal state of the gain. More...
 
template<typename SampleType >
SampleType JUCE_VECTOR_CALLTYPE processSample (SampleType s) noexcept
 Returns the result of processing a single sample. More...
 
template<typename ProcessContext >
void process (const ProcessContext &context) noexcept
 Processes the input and output buffers supplied in the processing context. More...
 

Detailed Description

template<typename FloatType>
class dsp::Gain< FloatType >

Applies a gain to audio samples as single samples or AudioBlocks.

Constructor & Destructor Documentation

◆ Gain()

template<typename FloatType >
dsp::Gain< FloatType >::Gain ( )
defaultnoexcept

Member Function Documentation

◆ setGainLinear()

template<typename FloatType >
void dsp::Gain< FloatType >::setGainLinear ( FloatType  newGain)
noexcept

Applies a new gain as a linear value.

References SmoothedValue< FloatType, SmoothingType >::setTargetValue().

Referenced by dsp::Gain< FloatType >::setGainDecibels().

◆ setGainDecibels()

template<typename FloatType >
void dsp::Gain< FloatType >::setGainDecibels ( FloatType  newGainDecibels)
noexcept

Applies a new gain as a decibel value.

References dsp::Gain< FloatType >::setGainLinear().

◆ getGainLinear()

template<typename FloatType >
FloatType dsp::Gain< FloatType >::getGainLinear ( ) const
noexcept

Returns the current gain as a linear value.

References SmoothedValueBase< SmoothedValueType >::getTargetValue().

Referenced by dsp::Gain< FloatType >::getGainDecibels().

◆ getGainDecibels()

template<typename FloatType >
FloatType dsp::Gain< FloatType >::getGainDecibels ( ) const
noexcept

Returns the current gain in decibels.

References dsp::Gain< FloatType >::getGainLinear().

◆ setRampDurationSeconds()

template<typename FloatType >
void dsp::Gain< FloatType >::setRampDurationSeconds ( double  newDurationSeconds)
noexcept

Sets the length of the ramp used for smoothing gain changes.

References dsp::Gain< FloatType >::reset().

◆ getRampDurationSeconds()

template<typename FloatType >
double dsp::Gain< FloatType >::getRampDurationSeconds ( ) const
noexcept

Returns the ramp duration in seconds.

◆ isSmoothing()

template<typename FloatType >
bool dsp::Gain< FloatType >::isSmoothing ( ) const
noexcept

Returns true if the current value is currently being interpolated.

References SmoothedValueBase< SmoothedValueType >::isSmoothing().

◆ prepare()

template<typename FloatType >
void dsp::Gain< FloatType >::prepare ( const ProcessSpec spec)
noexcept

Called before processing starts.

References dsp::Gain< FloatType >::reset().

◆ reset()

template<typename FloatType >
void dsp::Gain< FloatType >::reset ( )
noexcept

◆ processSample()

template<typename FloatType >
template<typename SampleType >
SampleType JUCE_VECTOR_CALLTYPE dsp::Gain< FloatType >::processSample ( SampleType  s)
noexcept

Returns the result of processing a single sample.

References SmoothedValue< FloatType, SmoothingType >::getNextValue().

◆ process()

template<typename FloatType >
template<typename ProcessContext >
void dsp::Gain< FloatType >::process ( const ProcessContext &  context)
noexcept

Processes the input and output buffers supplied in the processing context.

References SmoothedValue< FloatType, SmoothingType >::getNextValue(), jassert, FloatVectorOperations::multiply(), and SmoothedValue< FloatType, SmoothingType >::skip().


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