Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::signal::SixBandEqT< SampleType, Channels > Class Template Reference

A low shelf, four peaking sections, and a high shelf in series. More...

#include <six_band_eq.hpp>

Classes

struct  Parameters

Public Types

using Filter = BiquadT<SampleType>
using Type = typename Filter::Type
using Coefficients = BiquadCoefficientsT<SampleType>

Public Member Functions

 SixBandEqT ()
void prepare (SampleType sample_rate)
 Set the processing rate, re-clamp controls, derive coefficients, and clear all recursive history.
void set_transition_samples (std::size_t samples)
 Set the length of future coefficient transitions.
std::size_t transition_samples () const
bool transition_active (std::size_t channel) const
bool transition_active () const
bool set_band (std::size_t band, Parameters parameters)
 Change one band's plain-domain controls without clearing filter state.
void set_bands (const std::array< Parameters, band_count > &parameters)
 Atomically request all six bands.
Parameters band (std::size_t index) const
 Effective controls.
SampleType sample_rate () const
Coefficients coefficients (std::size_t band) const
 Exact normalized coefficients at the latest requested transition endpoint.
SampleType process (SampleType input, std::size_t channel=0)
 Process one sample. An invalid channel fails transparent.
bool process_block (SampleType *samples, std::size_t frames, std::size_t channel=0)
 Process one caller-owned channel in place.
void reset ()
 Clear recursive history while preserving rate and effective controls.
double magnitude (double frequency_hz) const
 Linear magnitude of the requested endpoint coefficient cascade.
double magnitude_db (double frequency_hz) const
 Decibel magnitude of the requested endpoint cascade, floored at -200 dB.
void response_curve_db (double min_hz, double max_hz, std::span< SampleType > output) const
 Fill caller-owned storage with a log-spaced response.

Static Public Member Functions

static constexpr Type band_type (std::size_t index)
static constexpr Parameters default_band (std::size_t index)

Static Public Attributes

static constexpr std::size_t band_count = 6
static constexpr std::size_t channel_count = Channels
static constexpr SampleType min_frequency_hz = SampleType{20}
static constexpr SampleType max_frequency_hz = SampleType{20000}
static constexpr SampleType min_gain_db = SampleType{-18}
static constexpr SampleType max_gain_db = SampleType{18}
static constexpr SampleType min_q = SampleType{0.1}
static constexpr SampleType max_q = SampleType{12}
static constexpr SampleType default_sample_rate = SampleType{48000}

Detailed Description

template<typename SampleType = float, std::size_t Channels = 2>
class pulp::signal::SixBandEqT< SampleType, Channels >

A low shelf, four peaking sections, and a high shelf in series.

The template's channel count is fixed so prepare, control changes, process, reset, and response inspection never allocate. Controls are plain-domain values intended to be changed between blocks. The default zero-sample transition preserves the legacy demo's immediate coefficient replacement. An opt-in transition crossfades two complete stable cascades; recursive coefficients are never interpolated. Both paths preserve filter history.

Member Typedef Documentation

◆ Coefficients

template<typename SampleType = float, std::size_t Channels = 2>
using pulp::signal::SixBandEqT< SampleType, Channels >::Coefficients = BiquadCoefficientsT<SampleType>

◆ Filter

template<typename SampleType = float, std::size_t Channels = 2>
using pulp::signal::SixBandEqT< SampleType, Channels >::Filter = BiquadT<SampleType>

◆ Type

template<typename SampleType = float, std::size_t Channels = 2>
using pulp::signal::SixBandEqT< SampleType, Channels >::Type = typename Filter::Type

Constructor & Destructor Documentation

◆ SixBandEqT()

template<typename SampleType = float, std::size_t Channels = 2>
pulp::signal::SixBandEqT< SampleType, Channels >::SixBandEqT ( )
inline

Member Function Documentation

◆ band()

template<typename SampleType = float, std::size_t Channels = 2>
Parameters pulp::signal::SixBandEqT< SampleType, Channels >::band ( std::size_t index) const
inline

Effective controls.

Invalid indices return neutral generic parameters; static role/default inspectors likewise return a peaking/neutral value.

◆ band_type()

template<typename SampleType = float, std::size_t Channels = 2>
constexpr Type pulp::signal::SixBandEqT< SampleType, Channels >::band_type ( std::size_t index)
inlinestaticconstexpr

◆ coefficients()

template<typename SampleType = float, std::size_t Channels = 2>
Coefficients pulp::signal::SixBandEqT< SampleType, Channels >::coefficients ( std::size_t band) const
inline

Exact normalized coefficients at the latest requested transition endpoint.

During a fade both stable cascades are active; response inspection intentionally describes the destination.

◆ default_band()

template<typename SampleType = float, std::size_t Channels = 2>
constexpr Parameters pulp::signal::SixBandEqT< SampleType, Channels >::default_band ( std::size_t index)
inlinestaticconstexpr

◆ magnitude()

template<typename SampleType = float, std::size_t Channels = 2>
double pulp::signal::SixBandEqT< SampleType, Channels >::magnitude ( double frequency_hz) const
inline

Linear magnitude of the requested endpoint coefficient cascade.

Query frequencies are saturated to [0, Nyquist]; non-finite queries use DC.

◆ magnitude_db()

template<typename SampleType = float, std::size_t Channels = 2>
double pulp::signal::SixBandEqT< SampleType, Channels >::magnitude_db ( double frequency_hz) const
inline

Decibel magnitude of the requested endpoint cascade, floored at -200 dB.

◆ prepare()

template<typename SampleType = float, std::size_t Channels = 2>
void pulp::signal::SixBandEqT< SampleType, Channels >::prepare ( SampleType sample_rate)
inline

Set the processing rate, re-clamp controls, derive coefficients, and clear all recursive history.

Rates too low to represent the public 20 Hz floor, or non-finite rates, select the 48 kHz safe default.

◆ process()

template<typename SampleType = float, std::size_t Channels = 2>
SampleType pulp::signal::SixBandEqT< SampleType, Channels >::process ( SampleType input,
std::size_t channel = 0 )
inline

Process one sample. An invalid channel fails transparent.

◆ process_block()

template<typename SampleType = float, std::size_t Channels = 2>
bool pulp::signal::SixBandEqT< SampleType, Channels >::process_block ( SampleType * samples,
std::size_t frames,
std::size_t channel = 0 )
inline

Process one caller-owned channel in place.

A null buffer with a non-zero frame count or an invalid channel is rejected without changing state.

A coefficient transition runs sample by sample; once none is pending, the rest of the block runs the six sections through Filter::process_chain(), which matches the sample path to the Biquad block path's accuracy contract (see BiquadT::process_chain()).

◆ reset()

template<typename SampleType = float, std::size_t Channels = 2>
void pulp::signal::SixBandEqT< SampleType, Channels >::reset ( )
inline

Clear recursive history while preserving rate and effective controls.

◆ response_curve_db()

template<typename SampleType = float, std::size_t Channels = 2>
void pulp::signal::SixBandEqT< SampleType, Channels >::response_curve_db ( double min_hz,
double max_hz,
std::span< SampleType > output ) const
inline

Fill caller-owned storage with a log-spaced response.

Invalid or reversed bounds collapse to the effective lower endpoint.

◆ sample_rate()

template<typename SampleType = float, std::size_t Channels = 2>
SampleType pulp::signal::SixBandEqT< SampleType, Channels >::sample_rate ( ) const
inline

◆ set_band()

template<typename SampleType = float, std::size_t Channels = 2>
bool pulp::signal::SixBandEqT< SampleType, Channels >::set_band ( std::size_t band,
Parameters parameters )
inline

Change one band's plain-domain controls without clearing filter state.

Returns false for an out-of-range band and leaves the instance unchanged.

◆ set_bands()

template<typename SampleType = float, std::size_t Channels = 2>
void pulp::signal::SixBandEqT< SampleType, Channels >::set_bands ( const std::array< Parameters, band_count > & parameters)
inline

Atomically request all six bands.

This is the preferred host-automation path when several controls change at one block boundary: every band shares one transition rather than serializing six fades.

◆ set_transition_samples()

template<typename SampleType = float, std::size_t Channels = 2>
void pulp::signal::SixBandEqT< SampleType, Channels >::set_transition_samples ( std::size_t samples)
inline

Set the length of future coefficient transitions.

Zero is the legacy immediate mode. Already scheduled transitions retain their duration and warmed filter state; assigning the current length is an exact no-op.

◆ transition_active() [1/2]

template<typename SampleType = float, std::size_t Channels = 2>
bool pulp::signal::SixBandEqT< SampleType, Channels >::transition_active ( ) const
inline

◆ transition_active() [2/2]

template<typename SampleType = float, std::size_t Channels = 2>
bool pulp::signal::SixBandEqT< SampleType, Channels >::transition_active ( std::size_t channel) const
inline

◆ transition_samples()

template<typename SampleType = float, std::size_t Channels = 2>
std::size_t pulp::signal::SixBandEqT< SampleType, Channels >::transition_samples ( ) const
inline

Member Data Documentation

◆ band_count

template<typename SampleType = float, std::size_t Channels = 2>
std::size_t pulp::signal::SixBandEqT< SampleType, Channels >::band_count = 6
staticconstexpr

◆ channel_count

template<typename SampleType = float, std::size_t Channels = 2>
std::size_t pulp::signal::SixBandEqT< SampleType, Channels >::channel_count = Channels
staticconstexpr

◆ default_sample_rate

template<typename SampleType = float, std::size_t Channels = 2>
SampleType pulp::signal::SixBandEqT< SampleType, Channels >::default_sample_rate = SampleType{48000}
staticconstexpr

◆ max_frequency_hz

template<typename SampleType = float, std::size_t Channels = 2>
SampleType pulp::signal::SixBandEqT< SampleType, Channels >::max_frequency_hz = SampleType{20000}
staticconstexpr

◆ max_gain_db

template<typename SampleType = float, std::size_t Channels = 2>
SampleType pulp::signal::SixBandEqT< SampleType, Channels >::max_gain_db = SampleType{18}
staticconstexpr

◆ max_q

template<typename SampleType = float, std::size_t Channels = 2>
SampleType pulp::signal::SixBandEqT< SampleType, Channels >::max_q = SampleType{12}
staticconstexpr

◆ min_frequency_hz

template<typename SampleType = float, std::size_t Channels = 2>
SampleType pulp::signal::SixBandEqT< SampleType, Channels >::min_frequency_hz = SampleType{20}
staticconstexpr

◆ min_gain_db

template<typename SampleType = float, std::size_t Channels = 2>
SampleType pulp::signal::SixBandEqT< SampleType, Channels >::min_gain_db = SampleType{-18}
staticconstexpr

◆ min_q

template<typename SampleType = float, std::size_t Channels = 2>
SampleType pulp::signal::SixBandEqT< SampleType, Channels >::min_q = SampleType{0.1}
staticconstexpr

The documentation for this class was generated from the following file:
  • /home/runner/work/pulp/pulp/core/signal/include/pulp/signal/six_band_eq.hpp