Tabula Sonora 0.1.0
A native C++20 implementation of the Roland Sound Canvas VA synth voice
Loading...
Searching...
No Matches
control_decode.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4#include <optional>
5#include <span>
6
7namespace ts {
8
56
61 int channel = -1;
62 int value = 0;
63
64 [[nodiscard]] constexpr bool is_global() const noexcept { return channel < 0; }
65};
66
71[[nodiscard]] std::optional<ControlUpdate>
72decode_control_change(int channel, int controller, int value) noexcept;
73
79[[nodiscard]] std::optional<ControlUpdate> decode_gs_sysex(std::span<const std::uint8_t> bytes,
80 int port = 0) noexcept;
81
86[[nodiscard]] bool gs_checksum_ok(std::span<const std::uint8_t> bytes) noexcept;
87
108
110struct XgAddress {
113 int high = 0;
114 int mid = 0;
115 int low = 0;
117 int value = 0;
120 int part = -1;
121};
122
132[[nodiscard]] XgAddress decode_xg_sysex(std::span<const std::uint8_t> bytes) noexcept;
133
139[[nodiscard]] std::optional<ControlUpdate> decode_xg_multi_part(const XgAddress& address) noexcept;
140
141} // namespace ts
Definition control_decode.hpp:7
ControlTarget
Every part parameter a MIDI message can set to a value.
Definition control_decode.hpp:17
@ velocity_offset
Definition control_decode.hpp:39
@ volume
Definition control_decode.hpp:18
@ eq_low_frequency
The system EQ block, which is global rather than per part.
Definition control_decode.hpp:48
@ eq_enabled
Per-part EQ enable (40 4x 20).
Definition control_decode.hpp:54
@ eq_high_frequency
Definition control_decode.hpp:50
@ env_decay
Definition control_decode.hpp:35
@ velocity_depth
Definition control_decode.hpp:38
@ matrix_pressure_pitch
Definition control_decode.hpp:45
@ env_attack
Definition control_decode.hpp:34
@ eq_high_gain
Definition control_decode.hpp:51
@ expression
Definition control_decode.hpp:19
@ reverb_send
Definition control_decode.hpp:23
@ vibrato_depth
Definition control_decode.hpp:31
@ pan
Definition control_decode.hpp:20
@ env_release
Definition control_decode.hpp:36
@ chorus_send
Definition control_decode.hpp:24
@ matrix_modulation_pitch
The control matrix's pitch routes, one per source.
Definition control_decode.hpp:44
@ delay_send
Definition control_decode.hpp:25
@ bank
Definition control_decode.hpp:26
@ modulation
Definition control_decode.hpp:21
@ vibrato_rate
Definition control_decode.hpp:30
@ eq_low_gain
Definition control_decode.hpp:49
@ bend_range
Definition control_decode.hpp:27
@ damper
Definition control_decode.hpp:22
@ channel_pressure
Definition control_decode.hpp:41
@ vibrato_delay
Definition control_decode.hpp:32
@ tvf_cutoff
Definition control_decode.hpp:33
bool gs_checksum_ok(std::span< const std::uint8_t > bytes) noexcept
Whether a GS DT1 message is well formed and its checksum folds to zero.
XgMessage
What an XG message is, for a caller deciding whether it has the machinery to act.
Definition control_decode.hpp:92
@ drum_setup
3n rr pp — a Drum Setup parameter.
Definition control_decode.hpp:106
@ none
Not XG, or an XG address this engine does nothing with.
Definition control_decode.hpp:94
@ system_parameter
00 00 00-03 master tune, 04 master volume, 06 transpose.
Definition control_decode.hpp:100
@ effect1
02 01 pp — reverb and chorus type, time and return.
Definition control_decode.hpp:102
@ all_parameter_reset
00 00 7F — All Parameter Reset.
Definition control_decode.hpp:98
@ multi_part
08 nn pp — a Multi Part parameter.
Definition control_decode.hpp:104
@ system_on
00 00 7E — switch every part onto the XG map and reset.
Definition control_decode.hpp:96
@ channel
A channel voice message.
Definition smf_reader.hpp:15
XgAddress decode_xg_sysex(std::span< const std::uint8_t > bytes) noexcept
Classifies an XG message and remaps its part number, without deciding what to do about it.
std::optional< ControlUpdate > decode_xg_multi_part(const XgAddress &address) noexcept
Which parameter an XG Multi Part message writes, if it writes one this vocabulary covers.
std::optional< ControlUpdate > decode_control_change(int channel, int controller, int value) noexcept
Which parameter a Control Change writes, if it writes one.
std::optional< ControlUpdate > decode_gs_sysex(std::span< const std::uint8_t > bytes, int port=0) noexcept
Which parameter a Roland GS DT1 message writes, if it writes one.
One parameter set by one message.
Definition control_decode.hpp:58
ControlTarget target
Definition control_decode.hpp:59
constexpr bool is_global() const noexcept
Definition control_decode.hpp:64
int channel
The part's channel, or -1 for the global targets.
Definition control_decode.hpp:61
int value
Definition control_decode.hpp:62
An XG message split into the parts a front end needs to act on it.
Definition control_decode.hpp:110
int high
Address bytes, as sent.
Definition control_decode.hpp:113
int low
Definition control_decode.hpp:115
XgMessage kind
Definition control_decode.hpp:111
int mid
Definition control_decode.hpp:114
int value
First data byte, or 0 for a message that carries none.
Definition control_decode.hpp:117
int part
For multi_part, the part the message addresses, already remapped from XG's part numbering to this eng...
Definition control_decode.hpp:120