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

Walks a pitch envelope one control tick at a time. More...

#include <tabulasonora/pitch_chain.hpp>

Public Member Functions

 PitchEnvelopeRunner (const PitchEnvelope &envelope, bool ignore_note_off=false)
 Creates a runner over a decoded envelope.
double level () const noexcept
 The offset in milli-semitones after the last tick.
void set_release_damper (int damper) noexcept
 Sets the half-damper pedal value the release will be scaled by, 1–0x3f or zero.
double tick (bool released) noexcept
 Advances one control tick and returns the offset in milli-semitones.

Static Public Member Functions

static PitchEnvelopeRunner constant (double level)
 A runner that holds one level forever, in milli-semitones.

Detailed Description

Walks a pitch envelope one control tick at a time.

Unlike the TVA and TVF envelopes, this one is not a function of elapsed time: a segment completes when a 16-bit phase accumulator reaches 0xffff — not exceeds it — and the next segment starts with a fresh phase rather than carrying the remainder, so the trajectory depends on the accumulator's history. It therefore has to be stepped rather than evaluated.

The value is stepwise, held for the whole control block, and the value returned by tick is the state after that tick's update.

Constructor & Destructor Documentation

◆ PitchEnvelopeRunner()

ts::PitchEnvelopeRunner::PitchEnvelopeRunner ( const PitchEnvelope & envelope,
bool ignore_note_off = false )
explicit

Creates a runner over a decoded envelope.

One-shot mode is bit 7 of partial block byte 0x00: the engine's note-off handler skips engaging the pitch release while the envelope machine still runs. It is what the .o variation tones use.

Member Function Documentation

◆ constant()

PitchEnvelopeRunner ts::PitchEnvelopeRunner::constant ( double level)
staticnodiscard

A runner that holds one level forever, in milli-semitones.

A partial with random start jitter but a disabled envelope still gets the jitter.

◆ level()

double ts::PitchEnvelopeRunner::level ( ) const
inlinenodiscardnoexcept

The offset in milli-semitones after the last tick.

◆ set_release_damper()

void ts::PitchEnvelopeRunner::set_release_damper ( int damper)
noexcept

Sets the half-damper pedal value the release will be scaled by, 1–0x3f or zero.

The engine writes the pedal value into the release ramp's rate-scale byte; the effective rate is rate * (0xffff - (v<<9)) >> 16. Only meaningful before the release engages.

◆ tick()

double ts::PitchEnvelopeRunner::tick ( bool released)
noexcept

Advances one control tick and returns the offset in milli-semitones.


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