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

What one source contributes, once its depths have been scaled by its current amount. More...

#include <tabulasonora/control_matrix.hpp>

Public Member Functions

constexpr int at (Destination destination) const noexcept
 One field, chosen by destination.
constexpr Modulationoperator+= (const Modulation &other) noexcept
 Accumulates another source's contribution.

Public Attributes

int pitch = 0
 added to the voice's pitch
int tvf_cutoff = 0
 added to the cutoff sum
int amplitude = 0
 scales the voice's level
int lfo1_rate = 0
int lfo1_pitch = 0
int lfo1_tvf = 0
int lfo1_tva = 0
int lfo2_rate = 0
int lfo2_pitch = 0
int lfo2_tvf = 0
int lfo2_tva = 0

Detailed Description

What one source contributes, once its depths have been scaled by its current amount.

Named fields rather than an array, deliberately. The engine's own output is eleven shorts in an order that is neither the SysEx order nor the storage order — within each LFO group it runs TVA, TVF, pitch, the reverse of how the messages arrive. Handing consumers an index would hand them that permutation to get wrong; handing them names retires it here.

Member Function Documentation

◆ at()

int ts::ControlMatrix::Modulation::at ( Destination destination) const
inlinenodiscardconstexprnoexcept

One field, chosen by destination.

Keyed by the enum rather than by an integer, which is the whole of what makes it safe: the permutation the fields exist to retire is a numeric one, and a caller who cannot supply a number cannot reintroduce it. Summing eleven destinations in a loop needs this; reaching for a single one should still use the field.

◆ operator+=()

Modulation & ts::ControlMatrix::Modulation::operator+= ( const Modulation & other)
inlineconstexprnoexcept

Accumulates another source's contribution.

The engine keeps one running sum a destination and every source adds into it before anything is clamped, so the sources have to be summed raw — adding scaled results instead would clamp each source separately and let the total escape the rail.

Member Data Documentation

◆ pitch

int ts::ControlMatrix::Modulation::pitch = 0

added to the voice's pitch

◆ tvf_cutoff

int ts::ControlMatrix::Modulation::tvf_cutoff = 0

added to the cutoff sum

◆ amplitude

int ts::ControlMatrix::Modulation::amplitude = 0

scales the voice's level

◆ lfo1_rate

int ts::ControlMatrix::Modulation::lfo1_rate = 0

◆ lfo1_pitch

int ts::ControlMatrix::Modulation::lfo1_pitch = 0

◆ lfo1_tvf

int ts::ControlMatrix::Modulation::lfo1_tvf = 0

◆ lfo1_tva

int ts::ControlMatrix::Modulation::lfo1_tva = 0

◆ lfo2_rate

int ts::ControlMatrix::Modulation::lfo2_rate = 0

◆ lfo2_pitch

int ts::ControlMatrix::Modulation::lfo2_pitch = 0

◆ lfo2_tvf

int ts::ControlMatrix::Modulation::lfo2_tvf = 0

◆ lfo2_tva

int ts::ControlMatrix::Modulation::lfo2_tva = 0

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