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::LadderFilter< SampleType > Class Template Reference

Multi-mode filter based on the Moog ladder filter. More...

#include <juce_LadderFilter.h>

Collaboration diagram for juce::dsp::LadderFilter< SampleType >:

Public Types

using Mode = LadderFilterMode
 

Public Member Functions

 LadderFilter ()
 Creates an uninitialised filter. More...
 
size_t getNumChannels () const noexcept
 Returns the current number of channels. More...
 
void prepare (const ProcessSpec &spec)
 Initialises the filter. More...
 
template<typename ProcessContext >
void process (const ProcessContext &context) noexcept
 
void reset () noexcept
 Resets the internal state variables of the filter. More...
 
void setCutoffFrequencyHz (SampleType newCutoff) noexcept
 Sets the cutoff frequency of the filter. More...
 
void setDrive (SampleType newDrive) noexcept
 Sets the amount of saturation in the filter. More...
 
void setEnabled (bool isEnabled) noexcept
 Enables or disables the filter. More...
 
void setMode (Mode newMode) noexcept
 Sets filter mode. More...
 
void setResonance (SampleType newResonance) noexcept
 Sets the resonance of the filter. More...
 

Protected Member Functions

SampleType processSample (SampleType inputValue, size_t channelToUse) noexcept
 
void updateSmoothers () noexcept
 

Private Member Functions

void setNumChannels (size_t newValue)
 
void setSampleRate (SampleType newValue) noexcept
 
void updateCutoffFreq () noexcept
 
void updateResonance () noexcept
 

Private Attributes

std::array< SampleType, numStatesA
 
SampleType comp
 
SampleType cutoffFreqHz { SampleType (200) }
 
SampleType cutoffFreqScaler
 
SmoothedValue< SampleType > cutoffTransformSmoother
 
SampleType cutoffTransformValue
 
SampleType drive
 
SampleType drive2
 
bool enabled = true
 
SampleType gain
 
SampleType gain2
 
Mode mode
 
SampleType resonance
 
LookupTableTransform< SampleType > saturationLUT
 
SmoothedValue< SampleType > scaledResonanceSmoother
 
SampleType scaledResonanceValue
 
std::vector< std::array< SampleType, numStates > > state
 

Static Private Attributes

static constexpr size_t numStates = 5
 

Detailed Description

template<typename SampleType>
class juce::dsp::LadderFilter< SampleType >

Multi-mode filter based on the Moog ladder filter.

@tags{DSP}

Member Typedef Documentation

◆ Mode

template<typename SampleType >
using juce::dsp::LadderFilter< SampleType >::Mode = LadderFilterMode

Constructor & Destructor Documentation

◆ LadderFilter()

template<typename SampleType >
juce::dsp::LadderFilter< SampleType >::LadderFilter ( )

Creates an uninitialised filter.

Call prepare() before first use.

Member Function Documentation

◆ getNumChannels()

template<typename SampleType >
size_t juce::dsp::LadderFilter< SampleType >::getNumChannels ( ) const
inlinenoexcept

Returns the current number of channels.

References juce::dsp::LadderFilter< SampleType >::state.

Referenced by juce::dsp::LadderFilter< SampleType >::process().

◆ prepare()

template<typename SampleType >
void juce::dsp::LadderFilter< SampleType >::prepare ( const ProcessSpec spec)

Initialises the filter.

◆ process()

◆ processSample()

template<typename SampleType >
SampleType juce::dsp::LadderFilter< SampleType >::processSample ( SampleType  inputValue,
size_t  channelToUse 
)
protectednoexcept

◆ reset()

template<typename SampleType >
void juce::dsp::LadderFilter< SampleType >::reset ( )
noexcept

Resets the internal state variables of the filter.

◆ setCutoffFrequencyHz()

template<typename SampleType >
void juce::dsp::LadderFilter< SampleType >::setCutoffFrequencyHz ( SampleType  newCutoff)
noexcept

Sets the cutoff frequency of the filter.

Parameters
newCutoffcutoff frequency in Hz

◆ setDrive()

template<typename SampleType >
void juce::dsp::LadderFilter< SampleType >::setDrive ( SampleType  newDrive)
noexcept

Sets the amount of saturation in the filter.

Parameters
newDrivesaturation amount; it can be any number greater than or equal to one. Higher values result in more distortion.

◆ setEnabled()

template<typename SampleType >
void juce::dsp::LadderFilter< SampleType >::setEnabled ( bool  isEnabled)
inlinenoexcept

Enables or disables the filter.

If disabled it will simply pass through the input signal.

References juce::dsp::LadderFilter< SampleType >::enabled.

◆ setMode()

template<typename SampleType >
void juce::dsp::LadderFilter< SampleType >::setMode ( Mode  newMode)
noexcept

Sets filter mode.

◆ setNumChannels()

template<typename SampleType >
void juce::dsp::LadderFilter< SampleType >::setNumChannels ( size_t  newValue)
inlineprivate

◆ setResonance()

template<typename SampleType >
void juce::dsp::LadderFilter< SampleType >::setResonance ( SampleType  newResonance)
noexcept

Sets the resonance of the filter.

Parameters
newResonancea value between 0 and 1; higher values increase the resonance and can result in self oscillation!

◆ setSampleRate()

template<typename SampleType >
void juce::dsp::LadderFilter< SampleType >::setSampleRate ( SampleType  newValue)
privatenoexcept

◆ updateCutoffFreq()

◆ updateResonance()

◆ updateSmoothers()

template<typename SampleType >
void juce::dsp::LadderFilter< SampleType >::updateSmoothers ( )
protectednoexcept

Member Data Documentation

◆ A

template<typename SampleType >
std::array<SampleType, numStates> juce::dsp::LadderFilter< SampleType >::A
private

◆ comp

template<typename SampleType >
SampleType juce::dsp::LadderFilter< SampleType >::comp
private

◆ cutoffFreqHz

template<typename SampleType >
SampleType juce::dsp::LadderFilter< SampleType >::cutoffFreqHz { SampleType (200) }
private

◆ cutoffFreqScaler

template<typename SampleType >
SampleType juce::dsp::LadderFilter< SampleType >::cutoffFreqScaler
private

◆ cutoffTransformSmoother

template<typename SampleType >
SmoothedValue<SampleType> juce::dsp::LadderFilter< SampleType >::cutoffTransformSmoother
private

◆ cutoffTransformValue

template<typename SampleType >
SampleType juce::dsp::LadderFilter< SampleType >::cutoffTransformValue
private

◆ drive

template<typename SampleType >
SampleType juce::dsp::LadderFilter< SampleType >::drive
private

◆ drive2

template<typename SampleType >
SampleType juce::dsp::LadderFilter< SampleType >::drive2
private

◆ enabled

template<typename SampleType >
bool juce::dsp::LadderFilter< SampleType >::enabled = true
private

◆ gain

template<typename SampleType >
SampleType juce::dsp::LadderFilter< SampleType >::gain
private

◆ gain2

template<typename SampleType >
SampleType juce::dsp::LadderFilter< SampleType >::gain2
private

◆ mode

template<typename SampleType >
Mode juce::dsp::LadderFilter< SampleType >::mode
private

◆ numStates

template<typename SampleType >
constexpr size_t juce::dsp::LadderFilter< SampleType >::numStates = 5
staticconstexprprivate

◆ resonance

template<typename SampleType >
SampleType juce::dsp::LadderFilter< SampleType >::resonance
private

◆ saturationLUT

template<typename SampleType >
LookupTableTransform<SampleType> juce::dsp::LadderFilter< SampleType >::saturationLUT
private
Initial value:
{ [] (SampleType x) { return std::tanh (x); },
SampleType (-5), SampleType (5), 128 }

◆ scaledResonanceSmoother

template<typename SampleType >
SmoothedValue<SampleType> juce::dsp::LadderFilter< SampleType >::scaledResonanceSmoother
private

◆ scaledResonanceValue

template<typename SampleType >
SampleType juce::dsp::LadderFilter< SampleType >::scaledResonanceValue
private

◆ state

template<typename SampleType >
std::vector<std::array<SampleType, numStates> > juce::dsp::LadderFilter< SampleType >::state
private

The documentation for this class was generated from the following file:
juce::gl::x
GLdouble x
Definition: juce_gl.h:939