46 [[nodiscard]]
double amp_of(
int level16)
const noexcept;
54 int velocity)
const noexcept;
61 int tone_level)
const noexcept;
84 int sample_rate = 32000,
85 double attack_milliseconds = 0.0,
86 std::optional<int> rate_key = std::nullopt,
100 int zone_level = 127,
101 int tone_level = 127,
102 int sample_rate = 32000,
103 double attack_milliseconds = 0.0,
104 std::optional<int> rate_key = std::nullopt)
const;
110 [[nodiscard]]
static double
115 std::span<const std::uint16_t> level_curve_;
116 std::span<const std::uint16_t> amp_high_;
117 std::span<const std::uint16_t> amp_low_;
118 std::span<const std::uint8_t> velocity_curve_;
119 std::span<const std::uint8_t> scale_curve_;
120 std::span<const std::uint8_t> level_key_follow_;
121 std::span<const std::uint8_t> rate_key_follow0_;
122 std::span<const std::uint8_t> rate_key_follow1_;
123 std::span<const std::uint8_t> velocity_crossfade_;
The segment-rate and segment-shape machine shared by the TVA, TVF and pitch envelopes.
Definition envelope_machine.hpp:22
A zero-copy typed view over one 0x6e-byte partial parameter block inside a tone record.
Definition partial_parameters.hpp:20
A four-segment envelope with a release, evaluated at any sample position.
Definition segment_envelope.hpp:21
The static tables the engine needs, loaded from SCCore.dll or from a directory of extracted ....
Definition table_set.hpp:30
int base_level(const PartialParameters &partial, int partial_level, int key, int zone_level, int tone_level) const noexcept
The 16-bit logarithmic base level for a voice, before the envelope moves it.
static constexpr int control_tick_hz
The control-tick rate, which is the grid note-off is acted on.
Definition tva_chain.hpp:31
std::vector< float > render(const PartialParameters &partial, int velocity, int key, double hold_seconds, double tail_seconds, int zone_level=127, int tone_level=127, int sample_rate=32000, double attack_milliseconds=0.0, std::optional< int > rate_key=std::nullopt) const
Renders the amplitude envelope for one note, or an empty vector when it cannot sound.
const EnvelopeMachine & envelope() const noexcept
The shared segment-rate machine.
Definition tva_chain.hpp:38
SegmentEnvelope create_envelope(const PartialParameters &partial, int velocity, int key, int zone_level=127, int tone_level=127, int sample_rate=32000, double attack_milliseconds=0.0, std::optional< int > rate_key=std::nullopt, const PartModifiers &modifiers={}) const
Builds the amplitude envelope for one note, ready to be evaluated at any sample position.
std::optional< int > partial_level(const PartialParameters &partial, int velocity) const noexcept
The partial's velocity-crossfaded level — the byte the engine keeps at voice+0x164.
static double part_volume_scale(int volume=127, int expression=127, int master=127) noexcept
The part-level volume multiplier, relative to everything at 127.
static constexpr double amp_scale
The engine hands the sampler twice the amplitude the level chain yields.
Definition tva_chain.hpp:28
double amp_of(int level16) const noexcept
Converts a 16-bit logarithmic level to a linear gain in [0, 1].
TvaChain(const TableSet &tables, const EnvelopeMachine &envelope)
Creates the chain over a loaded table set and the shared machine, both of which must outlive it.
Definition control_decode.hpp:7
@ volume
Definition control_decode.hpp:18
@ expression
Definition control_decode.hpp:19
The GS part modify offsets, as the synthesis chains consume them.
Definition part_modifiers.hpp:21