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

Dynamic equalizer bands with a level at every frequency inside each band. More...

#include <SpectralDynamicEQ.h>

Classes

struct  Band
 The settings of a band. More...
 

Public Types

enum class  Shape { Off , Bell , LowShelf , HighShelf }
 The shape of a band. More...
 

Public Member Functions

void prepare (const AudioSpec &spec)
 Allocates for a rate and a layout (an invalid spec is ignored).
 
void reset () noexcept
 Clears the analysis, the actions and the filter.
 
void setBand (int index, const Band &band) noexcept
 Sets a band (out-of-range indices are ignored; fields are clamped).
 
Band getBand (int index) const noexcept
 
void setDetail (T octaves) noexcept
 The detail: how finely the bands move inside themselves, from an octave to 1/24 of one (default 1/12). It moves while playing, at the same latency.
 
T getDetail () const noexcept
 
void setTimeFocus (bool on) noexcept
 Reads the levels at the top through a window that shortens as frequency rises, centred where the curve is played (off by default; see DetailAnalysis::setTimeFocus()), and plays a brief move as brief as it is drawn (DetailHold::None): what an event there sets off starts later and lasts less, at part of its depth and with less detail at the top.
 
bool getTimeFocus () const noexcept
 
int getLatency () const noexcept
 
double getGain (double hz) const noexcept
 
T getDisplayGain (int point) const noexcept
 
T getPeakGain () const noexcept
 
void processBlock (AudioBufferView< T > buffer) noexcept
 Processes the programme in place, its own level driving the bands.
 
void processBlock (AudioBufferView< T > buffer, AudioBufferView< T > key) noexcept
 Processes the programme in place, a key's level driving the bands.
 
std::vector< uint8_t > getState () const
 
bool setState (const uint8_t *data, size_t size)
 Restores the settings. A blob of the first version, with cells in each band, gives as detail the width of the finest of them (two bandwidths over the cells; 32 at a Q of 1 is 1/12).
 

Static Public Member Functions

static double getDisplayFrequency (int point) noexcept
 

Static Public Attributes

static constexpr int kBands = 4
 Bands.
 
static constexpr int kDisplayPoints = SpectralReadout<T>::kPoints
 Points of the display curve, evenly in log frequency from 20 Hz to 20 kHz.
 

Detailed Description

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

Dynamic equalizer bands with a level at every frequency inside each band.

Template Parameters
TSample type (float or double).

Definition at line 79 of file SpectralDynamicEQ.h.

Member Enumeration Documentation

◆ Shape

template<FloatType T>
enum class dspark::SpectralDynamicEQ::Shape
strong

The shape of a band.

Enumerator
Off 
Bell 
LowShelf 
HighShelf 

Definition at line 85 of file SpectralDynamicEQ.h.

Member Function Documentation

◆ getBand()

template<FloatType T>
Band dspark::SpectralDynamicEQ< T >::getBand ( int  index) const
inlinenoexcept
Returns
The settings of a band.

Definition at line 160 of file SpectralDynamicEQ.h.

◆ getDetail()

template<FloatType T>
T dspark::SpectralDynamicEQ< T >::getDetail ( ) const
inlinenoexcept
Returns
The detail, in octaves.

Definition at line 187 of file SpectralDynamicEQ.h.

◆ getDisplayFrequency()

template<FloatType T>
static double dspark::SpectralDynamicEQ< T >::getDisplayFrequency ( int  point)
inlinestaticnoexcept
Returns
The frequency of a display point, in hertz.

Definition at line 214 of file SpectralDynamicEQ.h.

◆ getDisplayGain()

template<FloatType T>
T dspark::SpectralDynamicEQ< T >::getDisplayGain ( int  point) const
inlinenoexcept
Returns
The gain played at a display point, in dB (all bands): the response of the kernels handed over every 21 ms, made by the first read after they change (any thread).

Definition at line 220 of file SpectralDynamicEQ.h.

◆ getGain()

template<FloatType T>
double dspark::SpectralDynamicEQ< T >::getGain ( double  hz) const
inlinenoexcept
Returns
The gain of the last frame at a frequency, in dB (audio thread or after processing).

Definition at line 204 of file SpectralDynamicEQ.h.

◆ getLatency()

template<FloatType T>
int dspark::SpectralDynamicEQ< T >::getLatency ( ) const
inlinenoexcept
Returns
The latency in samples.

Definition at line 202 of file SpectralDynamicEQ.h.

◆ getPeakGain()

template<FloatType T>
T dspark::SpectralDynamicEQ< T >::getPeakGain ( ) const
inlinenoexcept
Returns
The gain with the largest magnitude of that response, in dB, its sign kept (any thread).

Definition at line 222 of file SpectralDynamicEQ.h.

◆ getState()

template<FloatType T>
std::vector< uint8_t > dspark::SpectralDynamicEQ< T >::getState ( ) const
inline

Definition at line 232 of file SpectralDynamicEQ.h.

◆ getTimeFocus()

template<FloatType T>
bool dspark::SpectralDynamicEQ< T >::getTimeFocus ( ) const
inlinenoexcept
Returns
Whether the levels at the top are read through the focus.

Definition at line 199 of file SpectralDynamicEQ.h.

◆ prepare()

template<FloatType T>
void dspark::SpectralDynamicEQ< T >::prepare ( const AudioSpec &  spec)
inline

Allocates for a rate and a layout (an invalid spec is ignored).

Definition at line 101 of file SpectralDynamicEQ.h.

◆ processBlock() [1/2]

template<FloatType T>
void dspark::SpectralDynamicEQ< T >::processBlock ( AudioBufferView< T >  buffer)
inlinenoexcept

Processes the programme in place, its own level driving the bands.

Definition at line 225 of file SpectralDynamicEQ.h.

◆ processBlock() [2/2]

template<FloatType T>
void dspark::SpectralDynamicEQ< T >::processBlock ( AudioBufferView< T >  buffer,
AudioBufferView< T >  key 
)
inlinenoexcept

Processes the programme in place, a key's level driving the bands.

Definition at line 227 of file SpectralDynamicEQ.h.

◆ reset()

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

Clears the analysis, the actions and the filter.

Definition at line 129 of file SpectralDynamicEQ.h.

◆ setBand()

template<FloatType T>
void dspark::SpectralDynamicEQ< T >::setBand ( int  index,
const Band &  band 
)
inlinenoexcept

Sets a band (out-of-range indices are ignored; fields are clamped).

Definition at line 143 of file SpectralDynamicEQ.h.

◆ setDetail()

template<FloatType T>
void dspark::SpectralDynamicEQ< T >::setDetail ( T  octaves)
inlinenoexcept

The detail: how finely the bands move inside themselves, from an octave to 1/24 of one (default 1/12). It moves while playing, at the same latency.

Definition at line 181 of file SpectralDynamicEQ.h.

◆ setState()

template<FloatType T>
bool dspark::SpectralDynamicEQ< T >::setState ( const uint8_t *  data,
size_t  size 
)
inline

Restores the settings. A blob of the first version, with cells in each band, gives as detail the width of the finest of them (two bandwidths over the cells; 32 at a Q of 1 is 1/12).

Definition at line 260 of file SpectralDynamicEQ.h.

◆ setTimeFocus()

template<FloatType T>
void dspark::SpectralDynamicEQ< T >::setTimeFocus ( bool  on)
inlinenoexcept

Reads the levels at the top through a window that shortens as frequency rises, centred where the curve is played (off by default; see DetailAnalysis::setTimeFocus()), and plays a brief move as brief as it is drawn (DetailHold::None): what an event there sets off starts later and lasts less, at part of its depth and with less detail at the top.

Definition at line 197 of file SpectralDynamicEQ.h.

Member Data Documentation

◆ kBands

template<FloatType T>
constexpr int dspark::SpectralDynamicEQ< T >::kBands = 4
staticconstexpr

Bands.

Definition at line 82 of file SpectralDynamicEQ.h.

◆ kDisplayPoints

template<FloatType T>
constexpr int dspark::SpectralDynamicEQ< T >::kDisplayPoints = SpectralReadout<T>::kPoints
staticconstexpr

Points of the display curve, evenly in log frequency from 20 Hz to 20 kHz.

Definition at line 212 of file SpectralDynamicEQ.h.


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