Public Types | Public Member Functions | Public Attributes | List of all members
dsp::StateVariableFilter::Filter< SampleType > Class Template Reference

An IIR filter that can perform low, band and high-pass filtering on an audio signal, with 12 dB of attenuation per octave, using a TPT structure, designed for fast modulation (see Vadim Zavalishin's documentation about TPT structures for more information). More...

Public Types

using NumericType = typename SampleTypeHelpers::ElementType< SampleType >::Type
 The NumericType is the underlying primitive type used by the SampleType (which could be either a primitive or vector) More...
 
using ParametersPtr = typename Parameters< NumericType >::Ptr
 A typedef for a ref-counted pointer to the coefficients object. More...
 

Public Member Functions

 JUCE_DEPRECATED_WITH_BODY (Filter(), :parameters(new Parameters< NumericType >) { reset();}) JUCE_DEPRECATED_WITH_BODY(Filter(ParametersPtr parametersToUse)
 Creates a filter with default parameters. More...
 
 Filter (const Filter &)=default
 Creates a copy of another filter. More...
 
 Filter (Filter &&)=default
 Move constructor. More...
 
void prepare (const ProcessSpec &) noexcept
 Initialization of the filter. More...
 
void reset () noexcept
 Resets the filter's processing pipeline. More...
 
void snapToZero () noexcept
 Ensure that the state variables are rounded to zero if the state variables are denormals. More...
 
template<typename ProcessContext >
void process (const ProcessContext &context) noexcept
 
SampleType JUCE_VECTOR_CALLTYPE processSample (SampleType sample) noexcept
 Processes a single sample, without any locking or checking. More...
 

Public Attributes

 __pad0__: parameters (std::move (parametersToUse)) { reset()
 
Parameters< NumericType >::Ptr parameters
 The parameters of the state variable filter. More...
 

Detailed Description

template<typename SampleType>
class dsp::StateVariableFilter::Filter< SampleType >

An IIR filter that can perform low, band and high-pass filtering on an audio signal, with 12 dB of attenuation per octave, using a TPT structure, designed for fast modulation (see Vadim Zavalishin's documentation about TPT structures for more information).

Its behaviour is based on the analog state variable filter circuit.

Note: The bandpass here is not the one in the RBJ CookBook as its gain can be higher than 0 dB. For the classic 0 dB bandpass, we need to multiply the result by R2.

Note 2: Using this class prevents some loud audio artefacts commonly encountered when changing the cutoff frequency using other filter simulation structures and IIR filter classes. However, this class may still require additional smoothing for cutoff frequency changes.

see IIRFilter, SmoothedValue

Member Typedef Documentation

◆ NumericType

template<typename SampleType >
using dsp::StateVariableFilter::Filter< SampleType >::NumericType = typename SampleTypeHelpers::ElementType<SampleType>::Type

The NumericType is the underlying primitive type used by the SampleType (which could be either a primitive or vector)

◆ ParametersPtr

template<typename SampleType >
using dsp::StateVariableFilter::Filter< SampleType >::ParametersPtr = typename Parameters<NumericType>::Ptr

A typedef for a ref-counted pointer to the coefficients object.

Constructor & Destructor Documentation

◆ Filter() [1/2]

template<typename SampleType >
dsp::StateVariableFilter::Filter< SampleType >::Filter ( const Filter< SampleType > &  )
default

Creates a copy of another filter.

◆ Filter() [2/2]

template<typename SampleType >
dsp::StateVariableFilter::Filter< SampleType >::Filter ( Filter< SampleType > &&  )
default

Move constructor.

Member Function Documentation

◆ JUCE_DEPRECATED_WITH_BODY()

template<typename SampleType >
dsp::StateVariableFilter::Filter< SampleType >::JUCE_DEPRECATED_WITH_BODY ( Filter< SampleType >()  ,
:parameters(new Parameters< NumericType >) { reset();}   
)

Creates a filter with default parameters.

The classes in the StateVariableFilter namespace are deprecated. you should use the equivalent functionality in the StateVariableTPTFilter class. Creates a filter using some parameters.

The classes in the StateVariableFilter namespace are deprecated. you should use the equivalent functionality in the StateVariableTPTFilter class.

◆ prepare()

template<typename SampleType >
void dsp::StateVariableFilter::Filter< SampleType >::prepare ( const ProcessSpec )
noexcept

Initialization of the filter.

References dsp::StateVariableFilter::Filter< SampleType >::reset().

◆ reset()

template<typename SampleType >
void dsp::StateVariableFilter::Filter< SampleType >::reset ( )
noexcept

Resets the filter's processing pipeline.

Referenced by dsp::StateVariableFilter::Filter< SampleType >::prepare().

◆ snapToZero()

template<typename SampleType >
void dsp::StateVariableFilter::Filter< SampleType >::snapToZero ( )
noexcept

Ensure that the state variables are rounded to zero if the state variables are denormals.

This is only needed if you are doing sample by sample processing.

References dsp::util::snapToZero().

◆ process()

template<typename SampleType >
template<typename ProcessContext >
void dsp::StateVariableFilter::Filter< SampleType >::process ( const ProcessContext &  context)
noexcept

References gl::value.

◆ processSample()

template<typename SampleType >
SampleType JUCE_VECTOR_CALLTYPE dsp::StateVariableFilter::Filter< SampleType >::processSample ( SampleType  sample)
noexcept

Processes a single sample, without any locking or checking.

Use this if you need processing of a single value.

References jassertfalse, and dsp::StateVariableFilter::Filter< SampleType >::parameters.

Member Data Documentation

◆ __pad0__

template<typename SampleType >
dsp::StateVariableFilter::Filter< SampleType >::__pad0__

◆ parameters

template<typename SampleType >
Parameters<NumericType>::Ptr dsp::StateVariableFilter::Filter< SampleType >::parameters

The parameters of the state variable filter.

It's up to the caller to ensure that these parameters are modified in a thread-safe way.

Referenced by dsp::StateVariableFilter::Filter< SampleType >::processSample().


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