A processing class that can perform FIR filtering on an audio signal, in the time domain. More...
#include <juce_FIRFilter.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) More... | |
Public Member Functions | |
Filter () | |
This will create a filter which will produce silence. More... | |
Filter (Coefficients< NumericType > *coefficientsToUse) | |
Creates a filter with a given set of coefficients. More... | |
Filter (const Filter &)=default | |
Creates a copy of another filter. More... | |
Filter (Filter &&)=default | |
Creates a copy of another filter. More... | |
Filter & | operator= (const Filter &)=default |
Assignment operator. More... | |
Filter & | operator= (Filter &&)=default |
Assignment operator. More... | |
void | prepare (const ProcessSpec &spec) noexcept |
Prepare this filter for processing. More... | |
template<typename ProcessContext > | |
void | process (const ProcessContext &context) noexcept |
Processes as 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 |
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.
using 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)
|
inline |
This will create a filter which will produce silence.
References FIR::Filter< SampleType >::reset().
Referenced by FIR::Filter< SampleType >::Filter().
|
inline |
Creates a filter with a given set of coefficients.
References FIR::Filter< SampleType >::Filter(), FIR::Filter< SampleType >::operator=(), and FIR::Filter< SampleType >::reset().
|
default |
Creates a copy of another filter.
|
default |
Creates a copy of another filter.
|
inlineprivate |
References jassert, FIR::Filter< SampleType >::reset(), and FIR::Filter< SampleType >::size.
Referenced by FIR::Filter< SampleType >::process(), and FIR::Filter< SampleType >::processSample().
|
default |
Assignment operator.
Referenced by FIR::Filter< SampleType >::Filter(), and FIR::Coefficients< NumericType >::operator=().
|
default |
Assignment operator.
|
inlinenoexcept |
Prepare this filter for processing.
References juce::ignoreUnused(), jassert, and FIR::Filter< SampleType >::reset().
|
inlinenoexcept |
Processes as a block of samples.
References FIR::Filter< SampleType >::check(), FIR::Filter< SampleType >::fifo, jassert, FIR::Filter< SampleType >::pos, FIR::Filter< SampleType >::processSingleSample(), and FIR::Filter< SampleType >::size.
|
inlinenoexcept |
Processes a single sample, without any locking.
Use this if you need processing of a single value.
References FIR::Filter< SampleType >::check(), FIR::Filter< SampleType >::fifo, FIR::Filter< SampleType >::pos, FIR::Filter< SampleType >::processSingleSample(), and FIR::Filter< SampleType >::size.
|
inlinestaticprivatenoexcept |
References JUCE_LEAK_DETECTOR.
Referenced by FIR::Filter< SampleType >::process(), and FIR::Filter< SampleType >::processSample().
|
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. To disable the filter, call setEnabled (false).
References FIR::Filter< SampleType >::coefficients, FIR::Filter< SampleType >::fifo, HeapBlock< ElementType, throwOnFailure >::getData(), juce::jmax(), HeapBlock< ElementType, throwOnFailure >::malloc(), FIR::Filter< SampleType >::memory, FIR::Filter< SampleType >::size, and snapPointerToAlignment().
Referenced by FIR::Filter< SampleType >::check(), FIR::Filter< SampleType >::Filter(), and FIR::Filter< SampleType >::prepare().
Coefficients<NumericType>::Ptr FIR::Filter< SampleType >::coefficients |
The coefficients of the FIR filter.
It's up to the called 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 FIR::Coefficients< NumericType >::Coefficients(), FIR::Coefficients< NumericType >::getFilterOrder(), FIR::Coefficients< NumericType >::getRawCoefficients(), FIR::Coefficients< NumericType >::operator=(), and FIR::Filter< SampleType >::reset().
|
private |
|
private |
Referenced by FIR::Filter< SampleType >::reset().
|
private |
Referenced by FIR::Filter< SampleType >::process(), and FIR::Filter< SampleType >::processSample().
|
private |