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

A processing class that can perform FIR filtering on an audio signal, in the time domain. More...

#include <juce_FIRFilter.h>

Collaboration diagram for juce::dsp::FIR::Filter< SampleType >:

Public Types

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

Public Member Functions

 Filter ()
 This will create a filter which will produce silence. More...
 
 Filter (CoefficientsPtr coefficientsToUse)
 Creates a filter with a given set of coefficients. More...
 
 Filter (const Filter &)=default
 
 Filter (Filter &&)=default
 
Filteroperator= (const Filter &)=default
 
Filteroperator= (Filter &&)=default
 
void prepare (const ProcessSpec &spec) noexcept
 Prepare this filter for processing. More...
 
template<typename ProcessContext >
void process (const ProcessContext &context) noexcept
 Processes a block of samples. More...
 
SampleType JUCE_VECTOR_CALLTYPE processSample (SampleType sample) noexcept
 Processes a single sample, without any locking. More...
 
void reset ()
 Resets the filter's processing pipeline, ready to start a new stream of data. More...
 

Public Attributes

Coefficients< NumericType >::Ptr coefficients
 The coefficients of the FIR filter. More...
 

Private Member Functions

void check ()
 

Static Private Member Functions

static SampleType JUCE_VECTOR_CALLTYPE processSingleSample (SampleType sample, SampleType *buf, const NumericType *fir, size_t m, size_t &p) noexcept
 

Private Attributes

SampleType * fifo = nullptr
 
HeapBlock< SampleType > memory
 
size_t pos = 0
 
size_t size = 0
 

Detailed Description

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

A processing class that can perform FIR filtering on an audio signal, in the time domain.

Using FIRFilter is fast enough for FIRCoefficients with a size lower than 128 samples. For longer filters, it might be more efficient to use the class Convolution instead, which does the same processing in the frequency domain thanks to FFT.

See also
FIRFilter::Coefficients, Convolution, FFT

@tags{DSP}

Member Typedef Documentation

◆ CoefficientsPtr

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

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

◆ NumericType

template<typename SampleType >
using juce::dsp::FIR::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)

Constructor & Destructor Documentation

◆ Filter() [1/4]

template<typename SampleType >
juce::dsp::FIR::Filter< SampleType >::Filter ( )
inline

This will create a filter which will produce silence.

References juce::dsp::FIR::Filter< SampleType >::reset().

◆ Filter() [2/4]

template<typename SampleType >
juce::dsp::FIR::Filter< SampleType >::Filter ( CoefficientsPtr  coefficientsToUse)
inline

Creates a filter with a given set of coefficients.

References juce::dsp::FIR::Filter< SampleType >::reset().

◆ Filter() [3/4]

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

◆ Filter() [4/4]

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

Member Function Documentation

◆ check()

◆ operator=() [1/2]

template<typename SampleType >
Filter& juce::dsp::FIR::Filter< SampleType >::operator= ( const Filter< SampleType > &  )
default

◆ operator=() [2/2]

template<typename SampleType >
Filter& juce::dsp::FIR::Filter< SampleType >::operator= ( Filter< SampleType > &&  )
default

◆ prepare()

template<typename SampleType >
void juce::dsp::FIR::Filter< SampleType >::prepare ( const ProcessSpec spec)
inlinenoexcept

Prepare this filter for processing.

References jassertquiet, and juce::dsp::FIR::Filter< SampleType >::reset().

◆ process()

◆ processSample()

template<typename SampleType >
SampleType JUCE_VECTOR_CALLTYPE juce::dsp::FIR::Filter< SampleType >::processSample ( SampleType  sample)
inlinenoexcept

◆ processSingleSample()

template<typename SampleType >
static SampleType JUCE_VECTOR_CALLTYPE juce::dsp::FIR::Filter< SampleType >::processSingleSample ( SampleType  sample,
SampleType *  buf,
const NumericType fir,
size_t  m,
size_t &  p 
)
inlinestaticprivatenoexcept

◆ reset()

template<typename SampleType >
void juce::dsp::FIR::Filter< SampleType >::reset ( )
inline

Member Data Documentation

◆ coefficients

template<typename SampleType >
Coefficients<NumericType>::Ptr juce::dsp::FIR::Filter< SampleType >::coefficients

The coefficients of the FIR 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.

Referenced by juce::dsp::FIR::Filter< SampleType >::check(), juce::dsp::FIR::Filter< SampleType >::process(), juce::dsp::FIR::Filter< SampleType >::processSample(), and juce::dsp::FIR::Filter< SampleType >::reset().

◆ fifo

◆ memory

template<typename SampleType >
HeapBlock<SampleType> juce::dsp::FIR::Filter< SampleType >::memory
private

◆ pos

template<typename SampleType >
size_t juce::dsp::FIR::Filter< SampleType >::pos = 0
private

◆ size


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