|
DSPark 1.6.1
Header-only audio DSP framework in pure C++20 — zero dependencies
|
FIR filter using direct-form convolution with a mirrored delay line. More...
#include <FIRFilter.h>
Public Member Functions | |
| FIRFilter ()=default | |
| ~FIRFilter ()=default | |
| void | prepare (int maxTaps, int numChannels) |
| Pre-allocates memory and initializes the delay lines. | |
| void | setCoefficients (std::span< const T > coeffs) noexcept |
| Sets the filter coefficients asynchronously. | |
| void | reset () noexcept |
| Resets all delay lines to zero, clearing the filter's memory. | |
| void | processBlock (AudioBufferView< T > buffer) noexcept |
| Processes a full audio buffer in-place. | |
| T | processSample (T input, int channel) noexcept |
| Processes a single sample through the FIR filter. | |
| int | getLatency () const noexcept |
| Returns the filter's group delay (latency) in samples. | |
FIR filter using direct-form convolution with a mirrored delay line.
Implements a lock-free coefficient publish (seqlock) for safe asynchronous updates from the control thread without reallocating memory on the audio thread; the convolution itself runs through simd::dotProduct.
| T | Sample type (float or double). |
Definition at line 299 of file FIRFilter.h.
|
default |
|
default |
|
inlinenoexcept |
Returns the filter's group delay (latency) in samples.
Definition at line 471 of file FIRFilter.h.
|
inline |
Pre-allocates memory and initializes the delay lines.
| maxTaps | Maximum number of filter coefficients supported. |
| numChannels | Number of concurrent audio channels to process. |
Definition at line 312 of file FIRFilter.h.
|
inlinenoexcept |
Processes a full audio buffer in-place.
Loads atomic state once per block to avoid intra-block tearing and pipeline stalls.
| buffer | Audio buffer view to process. |
Definition at line 383 of file FIRFilter.h.
|
inlinenoexcept |
Processes a single sample through the FIR filter.
processBlock instead when possible to avoid atomic load overhead on a per-sample basis.| input | Input sample. |
| channel | Channel index. |
Definition at line 433 of file FIRFilter.h.
|
inlinenoexcept |
Resets all delay lines to zero, clearing the filter's memory.
Definition at line 369 of file FIRFilter.h.
|
inlinenoexcept |
Sets the filter coefficients asynchronously.
Coefficients are stored reversed for direct SIMD dot-product alignment.
| coeffs | Span of coefficients. Size must be <= maxTaps passed to prepare(). |
Definition at line 348 of file FIRFilter.h.