Tabula Sonora 0.1.0
A native C++20 implementation of the Roland Sound Canvas VA synth voice
Loading...
Searching...
No Matches
ts::Equalizer Class Reference

The GS four-band EQ: a low shelf and a high shelf, in series, on a stereo bus. More...

#include <tabulasonora/equalizer.hpp>

Public Member Functions

 Equalizer (const EffectPresets &presets) noexcept
 Creates an equalizer over a preset set, which must outlive it.
bool available () const noexcept
 Whether this equalizer can actually filter.
bool is_flat () const noexcept
 Whether the current settings would change the signal.
void set_low_frequency (int value) noexcept
 Sets one of the four parameters, as 40 02 0003 names them.
void set_low_gain (int value) noexcept
void set_high_frequency (int value) noexcept
void set_high_gain (int value) noexcept
void reset () noexcept
 Returns the block state to power-on: flat, with both corners at their lower choice.
void clear () noexcept
 Clears the filter memory without changing the settings.
void process (std::span< float > left, std::span< float > right) noexcept
 Filters a stereo block in place.

Static Public Attributes

static constexpr int flat_gain = 0x40
 The flat setting: 40 02 01 and 40 02 03 centred, both corners at their lower choice.

Detailed Description

The GS four-band EQ: a low shelf and a high shelf, in series, on a stereo bus.

Four bands in Roland's naming, two in this engine's: 40 02 exposes a frequency and a gain for each of low and high, and the two channels take the same pair. The engine writes each band's three coefficients to a left register and a right register with identical values (fx_eq_band_preset_apply sends every word twice, to 0xe6-0xe8 and again to 0xf3-0xf5), so the stereo image is untouched and only the spectrum moves.

This is not a send. It sits inline on the parts that switch it on with 40 4x 20, which is why it takes a stereo buffer and rewrites it rather than producing a wet signal to be mixed.

Constructor & Destructor Documentation

◆ Equalizer()

ts::Equalizer::Equalizer ( const EffectPresets & presets)
explicitnoexcept

Creates an equalizer over a preset set, which must outlive it.

A set with no EQ coefficients — one parsed from a pinned presets.json, which carries none — makes every process a no-op rather than a flat filter. Those are the same thing in theory and not in practice: running audio through a filter whose coefficients are all default would be silently wrong, and doing nothing is visibly nothing.

Member Function Documentation

◆ available()

bool ts::Equalizer::available ( ) const
inlinenodiscardnoexcept

Whether this equalizer can actually filter.

◆ is_flat()

bool ts::Equalizer::is_flat ( ) const
inlinenodiscardnoexcept

Whether the current settings would change the signal.

Both gains flat means both shelves are exactly unity, so the whole stage can be skipped without any difference in output — the identity is algebraic, not an approximation.

◆ set_low_frequency()

void ts::Equalizer::set_low_frequency ( int value)
noexcept

Sets one of the four parameters, as 40 02 0003 names them.

Values outside the engine's accepted ranges are ignored, as the engine ignores them: the frequency selectors take 0 or 1, and the gains take 0x34–0x4C.

◆ set_low_gain()

void ts::Equalizer::set_low_gain ( int value)
noexcept

◆ set_high_frequency()

void ts::Equalizer::set_high_frequency ( int value)
noexcept

◆ set_high_gain()

void ts::Equalizer::set_high_gain ( int value)
noexcept

◆ reset()

void ts::Equalizer::reset ( )
noexcept

Returns the block state to power-on: flat, with both corners at their lower choice.

◆ clear()

void ts::Equalizer::clear ( )
noexcept

Clears the filter memory without changing the settings.

◆ process()

void ts::Equalizer::process ( std::span< float > left,
std::span< float > right )
noexcept

Filters a stereo block in place.

Member Data Documentation

◆ flat_gain

int ts::Equalizer::flat_gain = 0x40
staticconstexpr

The flat setting: 40 02 01 and 40 02 03 centred, both corners at their lower choice.


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