DSPark 1.9.0
Header-only C++20 DSP for real-time and offline audio
Loading...
Searching...
No Matches
dspark::FirBank< T > Class Template Reference

Long FIR kernels over shared input lines, by partitioned convolution. More...

#include <FirBank.h>

Public Member Functions

void prepare (int kernelLength, int partition, int numInputs, int numKernels)
 Allocates the bank (setup thread).
 
bool isPrepared () const noexcept
 Whether prepare() has run.
 
int getLatency () const noexcept
 Samples between push() and tap(): one partition.
 
int getKernelLength () const noexcept
 Taps of a kernel (a whole number of partitions).
 
int getPartition () const noexcept
 Samples per partition.
 
int getNumInputs () const noexcept
 Input lines.
 
int getNumKernels () const noexcept
 Kernels the bank can hold.
 
void setKernel (int kernel, const T *taps, unsigned inputs) noexcept
 Gives a kernel its taps and the lines that hear it.
 
void removeKernel (int kernel) noexcept
 Fades a kernel out over the next partition.
 
bool isKernelSilent (int kernel) const noexcept
 Whether the outputs of a kernel are silence now: it is not playing and nothing of it is left to hear.
 
bool isKernelActive (int kernel) const noexcept
 Whether a kernel is playing, or about to.
 
void reset () noexcept
 Clears the memory of the signal. The kernels stay; one that was coming lands at once.
 
int room () const noexcept
 Samples that can be pushed before the next hop (1 to the partition).
 
const T * tap (int kernel, int input) const noexcept
 What a kernel gives for one of its lines: room() samples, one partition late, valid until the next push().
 
void push (const T *const *inputs, int n) noexcept
 Takes n samples of every input line; runs the hop when the partition fills.
 

Static Public Attributes

static constexpr int kMaxInputs = 32
 Input lines a mask can name.
 

Detailed Description

template<FloatType T>
class dspark::FirBank< T >

Long FIR kernels over shared input lines, by partitioned convolution.

Template Parameters
TSample type (float or double).

Definition at line 75 of file FirBank.h.

Member Function Documentation

◆ getKernelLength()

template<FloatType T>
int dspark::FirBank< T >::getKernelLength ( ) const
inlinenoexcept

Taps of a kernel (a whole number of partitions).

Definition at line 121 of file FirBank.h.

◆ getLatency()

template<FloatType T>
int dspark::FirBank< T >::getLatency ( ) const
inlinenoexcept

Samples between push() and tap(): one partition.

Definition at line 118 of file FirBank.h.

◆ getNumInputs()

template<FloatType T>
int dspark::FirBank< T >::getNumInputs ( ) const
inlinenoexcept

Input lines.

Definition at line 127 of file FirBank.h.

◆ getNumKernels()

template<FloatType T>
int dspark::FirBank< T >::getNumKernels ( ) const
inlinenoexcept

Kernels the bank can hold.

Definition at line 130 of file FirBank.h.

◆ getPartition()

template<FloatType T>
int dspark::FirBank< T >::getPartition ( ) const
inlinenoexcept

Samples per partition.

Definition at line 124 of file FirBank.h.

◆ isKernelActive()

template<FloatType T>
bool dspark::FirBank< T >::isKernelActive ( int  kernel) const
inlinenoexcept

Whether a kernel is playing, or about to.

Definition at line 177 of file FirBank.h.

◆ isKernelSilent()

template<FloatType T>
bool dspark::FirBank< T >::isKernelSilent ( int  kernel) const
inlinenoexcept

Whether the outputs of a kernel are silence now: it is not playing and nothing of it is left to hear.

Definition at line 171 of file FirBank.h.

◆ isPrepared()

template<FloatType T>
bool dspark::FirBank< T >::isPrepared ( ) const
inlinenoexcept

Whether prepare() has run.

Definition at line 115 of file FirBank.h.

◆ prepare()

template<FloatType T>
void dspark::FirBank< T >::prepare ( int  kernelLength,
int  partition,
int  numInputs,
int  numKernels 
)
inline

Allocates the bank (setup thread).

Parameters
kernelLengthTaps of every kernel; rounded up to a whole number of partitions.
partitionSamples per partition, rounded up to a power of two (at least 16): the latency.
numInputsInput lines (1 to kMaxInputs).
numKernelsKernels the bank can hold.

Definition at line 88 of file FirBank.h.

◆ push()

template<FloatType T>
void dspark::FirBank< T >::push ( const T *const *  inputs,
int  n 
)
inlinenoexcept

Takes n samples of every input line; runs the hop when the partition fills.

Parameters
inputsOne pointer per line (a null one is silence).
nSamples, at most room().

Definition at line 222 of file FirBank.h.

◆ removeKernel()

template<FloatType T>
void dspark::FirBank< T >::removeKernel ( int  kernel)
inlinenoexcept

Fades a kernel out over the next partition.

Definition at line 161 of file FirBank.h.

◆ reset()

template<FloatType T>
void dspark::FirBank< T >::reset ( )
inlinenoexcept

Clears the memory of the signal. The kernels stay; one that was coming lands at once.

Definition at line 185 of file FirBank.h.

◆ room()

template<FloatType T>
int dspark::FirBank< T >::room ( ) const
inlinenoexcept

Samples that can be pushed before the next hop (1 to the partition).

Definition at line 202 of file FirBank.h.

◆ setKernel()

template<FloatType T>
void dspark::FirBank< T >::setKernel ( int  kernel,
const T *  taps,
unsigned  inputs 
)
inlinenoexcept

Gives a kernel its taps and the lines that hear it.

The kernel comes in at the next hop, crossfaded over one partition against the one it replaces (or against silence). Setting a kernel again before that hop replaces the one that was coming.

Parameters
kernelKernel index; out of range is ignored.
tapsgetKernelLength() taps.
inputsMask of the input lines that hear it (bit i: line i).

Definition at line 143 of file FirBank.h.

◆ tap()

template<FloatType T>
const T * dspark::FirBank< T >::tap ( int  kernel,
int  input 
) const
inlinenoexcept

What a kernel gives for one of its lines: room() samples, one partition late, valid until the next push().

Silence for a line the kernel does not hear.

Definition at line 210 of file FirBank.h.

Member Data Documentation

◆ kMaxInputs

template<FloatType T>
constexpr int dspark::FirBank< T >::kMaxInputs = 32
staticconstexpr

Input lines a mask can name.

Definition at line 78 of file FirBank.h.


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