Loading...
Searching...
No Matches
juce::dsp::IIR::Filter< SampleType > Class Template Reference

## Detailed Description

template<typename SampleType>
class juce::dsp::IIR::Filter< SampleType >

A processing class that can perform IIR filtering on an audio signal, using the Transposed Direct Form II digital structure.

If you need a lowpass, bandpass or highpass filter with fast modulation of its cutoff frequency, you might use the class StateVariableFilter instead, which is designed to prevent artefacts at parameter changes, instead of the class Filter.

See also
  Filter::Coefficients, FilterAudioSource, StateVariableFilter

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

- juce_dsp/processors/juce_IIRFilter.h

## 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).
using | CoefficientsPtr = typename Coefficients<NumericType>::Ptr
| A typedef for a ref-counted pointer to the coefficients object.

## Public Member Functions

| Filter ()
| Creates a filter.
| Filter (CoefficientsPtr coefficientsToUse)
| Creates a filter with a given set of coefficients.
| Filter (const Filter &)=default
| Filter (Filter &&)=default
Filter & | operator= (const Filter &)=default
Filter & | operator= (Filter &&)=default
void | reset ()
| Resets the filter's processing pipeline, ready to start a new stream of data.
void | reset (SampleType resetToValue)
| Resets the filter's processing pipeline to a specific value.
void | prepare (const ProcessSpec &) noexcept
| Called before processing starts.
template<typename ProcessContext>
void | process (const ProcessContext &context) noexcept
| Processes a block of samples.
SampleType JUCE_VECTOR_CALLTYPE | processSample (SampleType sample) noexcept
| Processes a single sample, without any locking.
void | snapToZero () noexcept
| Ensure that the state variables are rounded to zero if the state variables are denormals.

## Public Attributes

CoefficientsPtr | coefficients
| The coefficients of the IIR filter.

## Member Typedef Documentation

## NumericType

template<typename SampleType>

using juce::dsp::IIR::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).

## CoefficientsPtr

template<typename SampleType>

using juce::dsp::IIR::Filter< SampleType >::CoefficientsPtr = typename Coefficients<NumericType>::Ptr

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

## Constructors and Destructors

## Filter() [1/4]

template<typename SampleType>

juce::dsp::IIR::Filter< SampleType >::Filter | ( |  | ) |

Creates a filter.

Initially the filter is inactive, so will have no effect on samples that you process with it. You can modify the coefficients member to turn it into the type of filter needed.

Referenced by Filter(), Filter(), operator=(), operator=(), and snapToZero().

## Filter() [2/4]

template<typename SampleType>

juce::dsp::IIR::Filter< SampleType >::Filter | ( | CoefficientsPtr | coefficientsToUse | ) |

Creates a filter with a given set of coefficients.

## Filter() [3/4]

template<typename SampleType>

juce::dsp::IIR::Filter< SampleType >::Filter | ( | const Filter< SampleType > & |  | ) |

default

References Filter().

## Filter() [4/4]

template<typename SampleType>

juce::dsp::IIR::Filter< SampleType >::Filter | ( | Filter< SampleType > && |  | ) |

default

References Filter().

## Member Functions

## operator=() [1/2]

template<typename SampleType>

Filter & juce::dsp::IIR::Filter< SampleType >::operator= | ( | const Filter< SampleType > & |  | ) |

default

References Filter().

## operator=() [2/2]

template<typename SampleType>

Filter & juce::dsp::IIR::Filter< SampleType >::operator= | ( | Filter< SampleType > && |  | ) |

default

References Filter().

## reset() [1/2]

template<typename SampleType>

void juce::dsp::IIR::Filter< SampleType >::reset | ( |  | ) |

inline

Resets the filter's processing pipeline, ready to start a new stream of data.

Note that this clears the processing state, but the type of filter and its coefficients aren't changed.

References reset().

Referenced by reset().

## reset() [2/2]

template<typename SampleType>

void juce::dsp::IIR::Filter< SampleType >::reset | ( | SampleType | resetToValue | ) |

Resets the filter's processing pipeline to a specific value.

See also
  reset

## prepare()

template<typename SampleType>

void juce::dsp::IIR::Filter< SampleType >::prepare | ( | const ProcessSpec & |  | ) |

noexcept

Called before processing starts.

## process()

template<typename SampleType>
template<typename ProcessContext>

void juce::dsp::IIR::Filter< SampleType >::process | ( | const ProcessContext & | context | ) |

inline noexcept

Processes a block of samples.

References snapToZero().

## processSample()

template<typename SampleType>

SampleType JUCE_VECTOR_CALLTYPE juce::dsp::IIR::Filter< SampleType >::processSample | ( | SampleType | sample | ) |

noexcept

Processes a single sample, without any locking.

Use this if you need processing of a single value.

Moreover, you might need the function snapToZero after a few calls to avoid potential denormalisation issues.

References JUCE_VECTOR_CALLTYPE.

## snapToZero()

template<typename SampleType>

void juce::dsp::IIR::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 Filter(), juce::dsp::isBypassed(), and JUCE_LEAK_DETECTOR.

Referenced by process().

## Member Data Documentation

## coefficients

template<typename SampleType>

CoefficientsPtr juce::dsp::IIR::Filter< SampleType >::coefficients

The coefficients of the IIR filter.

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

If you change the order of the coefficients then you must call reset after modifying them.

### Purchase

Get JUCE

### Discover

What's New in JUCE Features

### Learn

Documentaion Tutorials Made with JUCE Resources

### Support

JUCE Forum Newsletter Archive

### About

Contact Us JUCE Legal JUCE Licensing FAQ

### Events

Audio Developer Conference
© Raw Material Software Limited