JUCE  v5.4.1-191-g0ab5e696f
JUCE API
Looking for a senior C++ dev?
I'm looking for work. Hire me!
juce::dsp::LadderFilter< Type > Class Template Reference

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

#include <juce_LadderFilter.h>

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

Public Types

enum  Mode {
  Mode::LPF12,
  Mode::HPF12,
  Mode::LPF24,
  Mode::HPF24
}
 

Public Member Functions

 LadderFilter ()
 Creates an uninitialised filter. More...
 
size_t getNumChannels () const noexcept
 Returns the current number of channels. More...
 
void prepare (const juce::dsp::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 (Type newValue) noexcept
 Sets the cutoff frequency of the filter. More...
 
void setDrive (Type newValue) noexcept
 Sets the amound of saturation in the filter. More...
 
void setEnabled (bool newValue) noexcept
 Enables or disables the filter. More...
 
void setMode (Mode newValue) noexcept
 Sets filter mode. More...
 
void setResonance (Type newValue) noexcept
 Sets the resonance of the filter. More...
 

Protected Member Functions

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

Private Member Functions

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

Private Attributes

std::array< Type, numStatesA
 
Type comp
 
Type cutoffFreqHz { Type (200) }
 
Type cutoffFreqScaler
 
LinearSmoothedValue< Type > cutoffTransformSmoother
 
Type cutoffTransformValue
 
Type drive
 
Type drive2
 
bool enabled = true
 
Type gain
 
Type gain2
 
Mode mode
 
Type resonance
 
LookupTableTransform< Type > saturationLUT { [] (Type x) { return std::tanh (x); }, Type (-5), Type (5), 128 }
 
LinearSmoothedValue< Type > scaledResonanceSmoother
 
Type scaledResonanceValue
 
std::vector< std::array< Type, numStates > > state
 

Static Private Attributes

static constexpr size_t numStates = 5
 

Detailed Description

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

Multi-mode filter based on the Moog ladder filter.

{DSP}

Member Enumeration Documentation

◆ Mode

template<typename Type >
enum juce::dsp::LadderFilter::Mode
strong
Enumerator
LPF12 
HPF12 
LPF24 
HPF24 

Constructor & Destructor Documentation

◆ LadderFilter()

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

Creates an uninitialised filter.

Call prepare() before first use.

Member Function Documentation

◆ getNumChannels()

◆ prepare()

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

Initialises the filter.

Referenced by juce::dsp::LadderFilter< Type >::setEnabled().

◆ process()

◆ processSample()

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

◆ reset()

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

Resets the internal state variables of the filter.

Referenced by juce::dsp::LadderFilter< Type >::getNumChannels().

◆ setCutoffFrequencyHz()

template<typename Type >
void juce::dsp::LadderFilter< Type >::setCutoffFrequencyHz ( Type  newValue)
noexcept

Sets the cutoff frequency of the filter.

Parameters
newValuecutoff frequency in Hz

Referenced by juce::dsp::LadderFilter< Type >::getNumChannels().

◆ setDrive()

template<typename Type >
void juce::dsp::LadderFilter< Type >::setDrive ( Type  newValue)
noexcept

Sets the amound of saturation in the filter.

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

Referenced by juce::dsp::LadderFilter< Type >::getNumChannels().

◆ setEnabled()

template<typename Type >
void juce::dsp::LadderFilter< Type >::setEnabled ( bool  newValue)
inlinenoexcept

Enables or disables the filter.

If disabled it will simply pass through the input signal.

References juce::dsp::LadderFilter< Type >::enabled, juce::dsp::LadderFilter< Type >::prepare(), and juce::dsp::LadderFilter< Type >::setMode().

◆ setMode()

template<typename Type >
void juce::dsp::LadderFilter< Type >::setMode ( Mode  newValue)
noexcept

Sets filter mode.

Referenced by juce::dsp::LadderFilter< Type >::setEnabled().

◆ setNumChannels()

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

◆ setResonance()

template<typename Type >
void juce::dsp::LadderFilter< Type >::setResonance ( Type  newValue)
noexcept

Sets the resonance of the filter.

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

Referenced by juce::dsp::LadderFilter< Type >::getNumChannels().

◆ setSampleRate()

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

◆ updateCutoffFreq()

template<typename Type >
void juce::dsp::LadderFilter< Type >::updateCutoffFreq ( )
inlineprivatenoexcept

◆ updateResonance()

template<typename Type >
void juce::dsp::LadderFilter< Type >::updateResonance ( )
inlineprivatenoexcept

◆ updateSmoothers()

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

Member Data Documentation

◆ A

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

◆ comp

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

◆ cutoffFreqHz

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

◆ cutoffFreqScaler

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

◆ cutoffTransformSmoother

template<typename Type >
LinearSmoothedValue<Type> juce::dsp::LadderFilter< Type >::cutoffTransformSmoother
private

◆ cutoffTransformValue

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

◆ drive

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

◆ drive2

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

◆ enabled

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

◆ gain

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

◆ gain2

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

◆ mode

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

◆ numStates

template<typename Type >
constexpr size_t juce::dsp::LadderFilter< Type >::numStates = 5
staticprivate

◆ resonance

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

◆ saturationLUT

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

◆ scaledResonanceSmoother

template<typename Type >
LinearSmoothedValue<Type> juce::dsp::LadderFilter< Type >::scaledResonanceSmoother
private

◆ scaledResonanceValue

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

◆ state

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

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