JUCE  v5.1.1-3-g1a0b28c73
JUCE API
Gain< FloatType > Class Template Reference

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

#include <juce_Gain.h>

Collaboration diagram for Gain< FloatType >:

Public Member Functions

 Gain () noexcept
 
FloatType getGainDecibels () const noexcept
 Returns the current gain in decibels. More...
 
FloatType getGainLinear () const noexcept
 Returns the current gain as a linear value. 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...
 
template<typename ProcessContext >
void process (const ProcessContext &context) noexcept
 Processes the input and output buffers supplied in the processing context. More...
 
template<typename SampleType >
SampleType JUCE_VECTOR_CALLTYPE processSample (SampleType s) noexcept
 Returns the result of processing a single sample. More...
 
void reset () noexcept
 Resets the internal state of the gain. More...
 
void setGainDecibels (FloatType newGainDecibels) noexcept
 Applies a new gain as a decibel value. More...
 
void setGainLinear (FloatType newGain) noexcept
 Applies a new gain as a linear value. More...
 
void setRampDurationSeconds (double newDurationSeconds) noexcept
 Sets the length of the ramp used for smoothing gain changes. More...
 

Private Attributes

LinearSmoothedValue< FloatType > gain
 
double rampDurationSeconds = 0
 
double sampleRate = 0
 

Detailed Description

template<typename FloatType>
class Gain< FloatType >

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

Constructor & Destructor Documentation

◆ Gain()

template<typename FloatType >
Gain< FloatType >::Gain ( )
inlinenoexcept

Member Function Documentation

◆ getGainDecibels()

template<typename FloatType >
FloatType Gain< FloatType >::getGainDecibels ( ) const
inlinenoexcept

Returns the current gain in decibels.

References Gain< FloatType >::getGainLinear().

◆ getGainLinear()

template<typename FloatType >
FloatType Gain< FloatType >::getGainLinear ( ) const
inlinenoexcept

Returns the current gain as a linear value.

References Gain< FloatType >::gain.

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

◆ getRampDurationSeconds()

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

Returns the ramp duration in seconds.

References Gain< FloatType >::rampDurationSeconds.

◆ isSmoothing()

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

Returns true if the current value is currently being interpolated.

References Gain< FloatType >::gain.

◆ prepare()

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

Called before processing starts.

References Gain< FloatType >::reset(), and Gain< FloatType >::sampleRate.

◆ process()

template<typename FloatType >
template<typename ProcessContext >
void Gain< FloatType >::process ( const ProcessContext context)
inlinenoexcept

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

References Gain< FloatType >::gain, jassert, and FloatVectorOperations::multiply().

◆ processSample()

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

Returns the result of processing a single sample.

References Gain< FloatType >::gain.

◆ reset()

template<typename FloatType >
void Gain< FloatType >::reset ( )
inlinenoexcept

◆ setGainDecibels()

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

Applies a new gain as a decibel value.

References Gain< FloatType >::setGainLinear().

◆ setGainLinear()

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

Applies a new gain as a linear value.

References Gain< FloatType >::gain.

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

◆ setRampDurationSeconds()

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

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

References Gain< FloatType >::rampDurationSeconds, and Gain< FloatType >::reset().

Member Data Documentation

◆ gain

◆ rampDurationSeconds

template<typename FloatType >
double Gain< FloatType >::rampDurationSeconds = 0
private

◆ sampleRate

template<typename FloatType >
double Gain< FloatType >::sampleRate = 0
private

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