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

A bank of overlapping sections driven by least squares. More...

#include <GraphicBank.h>

Public Member Functions

void prepare (double sampleRate, const double *centresHz, int bands, int channels, double qScale=1.0, const double *widthsHz=nullptr)
 Lays the bank out (allocates).
 
int getNumBands () const noexcept
 
double getCentre (int band) const noexcept
 
int getLatency () const noexcept
 
double getSectionGain (int section) const noexcept
 
void setGains (const T *gainsDb, int rampSamples, int refine=1) noexcept
 The gains asked of the bands.
 
double responseDb (double hz) const noexcept
 
void reset () noexcept
 Clears the history (the gains stay).
 
void processBlock (AudioBufferView< T > buffer) noexcept
 Runs a block in place.
 

Static Public Attributes

static constexpr int kMaxBands = 256
 
static constexpr int kCarryRefinement = -1
 setGains(): no refining step; the correction of the last refining call is added instead.
 

Detailed Description

template<FloatType T, int Lanes = 8>
class dspark::GraphicBank< T, Lanes >

A bank of overlapping sections driven by least squares.

Template Parameters
TSample type (float or double).
LanesLanes of the cascade (latency Lanes - 1).

Definition at line 71 of file GraphicBank.h.

Member Function Documentation

◆ getCentre()

template<FloatType T, int Lanes = 8>
double dspark::GraphicBank< T, Lanes >::getCentre ( int  band) const
inlinenoexcept

Definition at line 195 of file GraphicBank.h.

◆ getLatency()

template<FloatType T, int Lanes = 8>
int dspark::GraphicBank< T, Lanes >::getLatency ( ) const
inlinenoexcept
Returns
The latency: Lanes - 1 samples on one channel, none on more.

Definition at line 197 of file GraphicBank.h.

◆ getNumBands()

template<FloatType T, int Lanes = 8>
int dspark::GraphicBank< T, Lanes >::getNumBands ( ) const
inlinenoexcept

Definition at line 194 of file GraphicBank.h.

◆ getSectionGain()

template<FloatType T, int Lanes = 8>
double dspark::GraphicBank< T, Lanes >::getSectionGain ( int  section) const
inlinenoexcept
Returns
A section's gain in dB (not the band's: see the file comment).

Definition at line 199 of file GraphicBank.h.

◆ prepare()

template<FloatType T, int Lanes = 8>
void dspark::GraphicBank< T, Lanes >::prepare ( double  sampleRate,
const double *  centresHz,
int  bands,
int  channels,
double  qScale = 1.0,
const double *  widthsHz = nullptr 
)
inline

Lays the bank out (allocates).

Parameters
sampleRateRate (invalid values are ignored).
centresHzBand centres, rising (clamped under 0.49 of the rate).
bandsNumber of bands, 2 to 256.
channelsChannels to run.
qScaleThe bells' Q is the centre over the critical bandwidth there, times this (0.25 to 8).
widthsHzWidth of each bell in hertz, in place of the critical bandwidth (bands closer together than a third of a critical band need bells that narrow with them); nullptr, the default, keeps the critical bandwidth.

Definition at line 91 of file GraphicBank.h.

◆ processBlock()

template<FloatType T, int Lanes = 8>
void dspark::GraphicBank< T, Lanes >::processBlock ( AudioBufferView< T >  buffer)
inlinenoexcept

Runs a block in place.

Definition at line 276 of file GraphicBank.h.

◆ reset()

template<FloatType T, int Lanes = 8>
void dspark::GraphicBank< T, Lanes >::reset ( )
inlinenoexcept

Clears the history (the gains stay).

Definition at line 273 of file GraphicBank.h.

◆ responseDb()

template<FloatType T, int Lanes = 8>
double dspark::GraphicBank< T, Lanes >::responseDb ( double  hz) const
inlinenoexcept
Returns
The bank's response at a frequency, in dB, with the gains last set.

Definition at line 264 of file GraphicBank.h.

◆ setGains()

template<FloatType T, int Lanes = 8>
void dspark::GraphicBank< T, Lanes >::setGains ( const T *  gainsDb,
int  rampSamples,
int  refine = 1 
)
inlinenoexcept

The gains asked of the bands.

Parameters
gainsDbgetNumBands() gains in dB (clamped to +-24).
rampSamplesSamples over which the sections glide to them.
refineRefining steps (0 to 3) on the real response, or kCarryRefinement.

Definition at line 208 of file GraphicBank.h.

Member Data Documentation

◆ kCarryRefinement

template<FloatType T, int Lanes = 8>
constexpr int dspark::GraphicBank< T, Lanes >::kCarryRefinement = -1
staticconstexpr

setGains(): no refining step; the correction of the last refining call is added instead.

Definition at line 76 of file GraphicBank.h.

◆ kMaxBands

template<FloatType T, int Lanes = 8>
constexpr int dspark::GraphicBank< T, Lanes >::kMaxBands = 256
staticconstexpr

Definition at line 74 of file GraphicBank.h.


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