JUCE  v6.1.6 (6.0.8-1114)
JUCE API
Looking for a senior C++ dev?
I'm looking for work. Hire me!
juce::dsp::Gain< FloatType > Class Template Reference

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

#include <juce_Gain.h>

Collaboration diagram for juce::dsp::Gain< FloatType >:

Public Member Functions

 Gain () noexcept=default
 
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

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

Detailed Description

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

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

@tags{DSP}

Constructor & Destructor Documentation

◆ Gain()

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

Member Function Documentation

◆ getGainDecibels()

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

Returns the current gain in decibels.

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

◆ getGainLinear()

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

◆ getRampDurationSeconds()

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

Returns the ramp duration in seconds.

References juce::dsp::Gain< FloatType >::rampDurationSeconds.

◆ isSmoothing()

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

Returns true if the current value is currently being interpolated.

References juce::dsp::Gain< FloatType >::gain, and juce::SmoothedValueBase< SmoothedValueType >::isSmoothing().

◆ prepare()

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

Called before processing starts.

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

◆ process()

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

◆ processSample()

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

Returns the result of processing a single sample.

References juce::dsp::Gain< FloatType >::gain, juce::SmoothedValue< FloatType, SmoothingType >::getNextValue(), and juce::gl::s.

◆ reset()

◆ setGainDecibels()

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

Applies a new gain as a decibel value.

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

◆ setGainLinear()

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

◆ setRampDurationSeconds()

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

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

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

Member Data Documentation

◆ gain

◆ rampDurationSeconds

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

◆ sampleRate

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

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