Tabula Sonora 0.1.0
A native C++20 implementation of the Roland Sound Canvas VA synth voice
Loading...
Searching...
No Matches
render_options.hpp
Go to the documentation of this file.
1#pragma once
2
3// The render vocabulary -- channel mask, options and result -- that outlived the whole-note
4// renderer these types were declared in. See the verification article for why that path was
5// retired.
6
9
10#include <atomic>
11#include <filesystem>
12#include <optional>
13#include <vector>
14
15namespace ts {
16
29public:
35 static constexpr int channel_count = 64;
36
40 [[nodiscard]] bool is_audible(int channel) const noexcept;
41
42 [[nodiscard]] bool is_muted(int channel) const noexcept;
43 [[nodiscard]] bool is_soloed(int channel) const noexcept;
44 [[nodiscard]] bool any_soloed() const noexcept;
45
46 void set_muted(int channel, bool muted) noexcept;
47 void set_soloed(int channel, bool soloed) noexcept;
48 void reset() noexcept;
49
51 [[nodiscard]] bool is_default() const noexcept;
52
53private:
54 std::array<std::atomic<bool>, channel_count> muted_{};
55 std::array<std::atomic<bool>, channel_count> soloed_{};
56};
57
62
64 double tail_seconds = 2.2;
65
67 double output_gain = 1.0;
68
70 int drum_channel = 9;
71
77 std::optional<int> drum_map_row;
78
80 [[nodiscard]] int effective_drum_map_row() const noexcept
81 {
82 if (drum_map_row) {
83 return *drum_map_row;
84 }
85 return DrumKitTable::row_for_map(map).value_or(0);
86 }
87
88 bool reverb = true;
89 bool chorus = true;
90 bool delay = true;
91 bool efx = true;
92
94 std::optional<int> reverb_type;
95 std::optional<int> chorus_type;
96 std::optional<int> delay_type;
97
99 std::optional<double> end_seconds;
100
102 const ChannelMask* channels = nullptr;
103
104};
105
108 std::vector<float> left;
109 std::vector<float> right;
112 int note_count = 0;
114 float peak = 0.0F;
115};
116
117} // namespace ts
Per-channel mute and solo.
Definition render_options.hpp:28
static constexpr int channel_count
Parts the mask covers: sixty-four, port * 16 + channel.
Definition render_options.hpp:35
void set_muted(int channel, bool muted) noexcept
bool any_soloed() const noexcept
bool is_default() const noexcept
Whether nothing is muted or soloed, so every channel sounds.
bool is_muted(int channel) const noexcept
bool is_soloed(int channel) const noexcept
void reset() noexcept
bool is_audible(int channel) const noexcept
Whether a channel should sound.
void set_soloed(int channel, bool soloed) noexcept
static std::optional< int > row_for_map(ToneMap map) noexcept
The drum map row a vintage's tone map selects, or nothing where no measurement pins one.
static constexpr int sample_rate
Internal sample rate.
Definition note_renderer.hpp:48
Definition control_decode.hpp:7
ToneMap
Which vintage's tone map a program change resolves against.
Definition patch_directory.hpp:22
@ sc8820
Definition patch_directory.hpp:26
@ channel
A channel voice message.
Definition smf_reader.hpp:15
How a sequence should be rendered.
Definition render_options.hpp:59
ToneMap map
Which vintage's tone map program changes resolve against.
Definition render_options.hpp:61
bool chorus
Definition render_options.hpp:89
int effective_drum_map_row() const noexcept
The row this actually resolves to.
Definition render_options.hpp:80
std::optional< int > reverb_type
Force an effect type instead of taking it from the stream.
Definition render_options.hpp:94
int drum_channel
MIDI channel routed to the drum path.
Definition render_options.hpp:70
bool delay
Definition render_options.hpp:90
std::optional< int > chorus_type
Definition render_options.hpp:95
bool reverb
Definition render_options.hpp:88
const ChannelMask * channels
Per-channel mute and solo, or nothing for everything audible.
Definition render_options.hpp:102
double tail_seconds
Time to render past the last note.
Definition render_options.hpp:64
bool efx
Definition render_options.hpp:91
std::optional< double > end_seconds
Stop rendering at this many seconds, if given.
Definition render_options.hpp:99
std::optional< int > drum_map_row
Drum map row, or nothing to take the row the vintage selects.
Definition render_options.hpp:77
double output_gain
Linear gain applied to the finished mix.
Definition render_options.hpp:67
std::optional< int > delay_type
Definition render_options.hpp:96
A finished render.
Definition render_options.hpp:107
int sample_rate
Definition render_options.hpp:110
std::vector< float > right
Definition render_options.hpp:109
float peak
Peak absolute sample across both channels, after the output gain.
Definition render_options.hpp:114
int note_count
How many notes actually rendered.
Definition render_options.hpp:112
std::vector< float > left
Definition render_options.hpp:108