Skip to content

Commit cb20541

Browse files
authored
Add MIDICCNames tables (#162)
1 parent b548af9 commit cb20541

File tree

2 files changed

+313
-0
lines changed

2 files changed

+313
-0
lines changed
Lines changed: 312 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,312 @@
1+
/*
2+
* sst-basic-blocks - an open source library of core audio utilities
3+
* built by Surge Synth Team.
4+
*
5+
* Provides a collection of tools useful on the audio thread for blocks,
6+
* modulation, etc... or useful for adapting code to multiple environments.
7+
*
8+
* Copyright 2023, various authors, as described in the GitHub
9+
* transaction log. Parts of this code are derived from similar
10+
* functions original in Surge or ShortCircuit.
11+
*
12+
* sst-basic-blocks is released under the GNU General Public Licence v3
13+
* or later (GPL-3.0-or-later). The license is found in the "LICENSE"
14+
* file in the root of this repository, or at
15+
* https://www.gnu.org/licenses/gpl-3.0.en.html.
16+
*
17+
* A very small number of explicitly chosen header files can also be
18+
* used in an MIT/BSD context. Please see the README.md file in this
19+
* repo or the comments in the individual files. Only headers with an
20+
* explicit mention that they are dual licensed may be copied and reused
21+
* outside the GPL3 terms.
22+
*
23+
* All source in sst-basic-blocks available at
24+
* https://github.com/surge-synthesizer/sst-basic-blocks
25+
*/
26+
27+
#ifndef INCLUDE_SST_BASIC_BLOCKS_TABLES_MIDICCNAMES_H
28+
#define INCLUDE_SST_BASIC_BLOCKS_TABLES_MIDICCNAMES_H
29+
30+
#include <string>
31+
32+
namespace sst::basic_blocks::tables
33+
{
34+
static inline std::string MIDI1CCLongName(int cc)
35+
{
36+
if (cc < 0 || cc > 128)
37+
return "<error>";
38+
39+
const std::string midicc_names[128] = {"Bank Select MSB",
40+
"Modulation Wheel MSB",
41+
"Breath Controller MSB",
42+
"Control 3 MSB",
43+
"Foot Controller MSB",
44+
"Portamento Time MSB",
45+
"Data Entry MSB",
46+
"Volume MSB",
47+
"Balance MSB",
48+
"Control 9 MSB",
49+
"Pan MSB",
50+
"Expression MSB",
51+
"Effect #1 MSB",
52+
"Effect #2 MSB",
53+
"Control 14 MSB",
54+
"Control 15 MSB",
55+
"General Purpose Controller #1 MSB",
56+
"General Purpose Controller #2 MSB",
57+
"General Purpose Controller #3 MSB",
58+
"General Purpose Controller #4 MSB",
59+
"Control 20 MSB",
60+
"Control 21 MSB",
61+
"Control 22 MSB",
62+
"Control 23 MSB",
63+
"Control 24 MSB",
64+
"Control 25 MSB",
65+
"Control 26 MSB",
66+
"Control 27 MSB",
67+
"Control 28 MSB",
68+
"Control 29 MSB",
69+
"Control 30 MSB",
70+
"Control 31 MSB",
71+
"Bank Select LSB",
72+
"Modulation Wheel LSB",
73+
"Breath Controller LSB",
74+
"Control 3 LSB",
75+
"Foot Controller LSB",
76+
"Portamento Time LSB",
77+
"Data Entry LSB",
78+
"Volume LSB",
79+
"Balance LSB",
80+
"Control 9 LSB",
81+
"Pan LSB",
82+
"Expression LSB",
83+
"Effect #1 LSB",
84+
"Effect #2 LSB",
85+
"Control 14 LSB",
86+
"Control 15 LSB",
87+
"General Purpose Controller #1 LSB",
88+
"General Purpose Controller #2 LSB",
89+
"General Purpose Controller #3 LSB",
90+
"General Purpose Controller #4 LSB",
91+
"Control 20 LSB",
92+
"Control 21 LSB",
93+
"Control 22 LSB",
94+
"Control 23 LSB",
95+
"Control 24 LSB",
96+
"Control 25 LSB",
97+
"Control 26 LSB",
98+
"Control 27 LSB",
99+
"Control 28 LSB",
100+
"Control 29 LSB",
101+
"Control 30 LSB",
102+
"Control 31 LSB",
103+
"Sustain Pedal",
104+
"Portamento Pedal",
105+
"Sostenuto Pedal",
106+
"Soft Pedal",
107+
"Legato Pedal",
108+
"Hold Pedal",
109+
"Sound Control #1 Sound Variation",
110+
"Sound Control #2 Timbre",
111+
"Sound Control #3 Release Time",
112+
"Sound Control #4 Attack Time",
113+
"Sound Control #5 Brightness / MPE Timbre",
114+
"Sound Control #6 Decay Time",
115+
"Sound Control #7 Vibrato Rate",
116+
"Sound Control #8 Vibrato Depth",
117+
"Sound Control #9 Vibrato Delay",
118+
"Sound Control #10 Control 79",
119+
"General Purpose Controller #5",
120+
"General Purpose Controller #6",
121+
"General Purpose Controller #7",
122+
"General Purpose Controller #8",
123+
"Portamento Control",
124+
"Control 85",
125+
"Control 86",
126+
"Control 87",
127+
"High Resolution Velocity Prefix",
128+
"Control 89",
129+
"Control 90",
130+
"Reverb Send Level",
131+
"Tremolo Depth",
132+
"Chorus Send Level",
133+
"Celeste Depth",
134+
"Phaser Depth",
135+
"Data Increment",
136+
"Data Decrement",
137+
"NRPN LSB",
138+
"NRPN MSB",
139+
"RPN LSB",
140+
"RPN MLSB",
141+
"Control 102",
142+
"Control 103",
143+
"Control 104",
144+
"Control 105",
145+
"Control 106",
146+
"Control 107",
147+
"Control 108",
148+
"Control 109",
149+
"Control 110",
150+
"Control 111",
151+
"Control 112",
152+
"Control 113",
153+
"Control 114",
154+
"Control 115",
155+
"Control 116",
156+
"Control 117",
157+
"Control 118",
158+
"Control 119",
159+
"Control 120 All Sound Off",
160+
"Control 121 Reset All Controllers",
161+
"Control 122 Local Control On/Off",
162+
"Control 123 All Notes Off",
163+
"Control 124 Omni Mode Off",
164+
"Control 125 Omni Mode On",
165+
"Control 126 Mono Mode Off",
166+
"Control 127 Mono Mode On"};
167+
return midicc_names[cc];
168+
}
169+
170+
/*
171+
* Abbreviated names suitable for augmenting a menu which sohows midi CCs.
172+
* Will return blank for things like "High Resolution Velocity Prefix"
173+
*/
174+
static inline std::string MIDI1CCVeryShortName(int cc)
175+
{
176+
if (cc < 0 || cc > 128)
177+
return "<error>";
178+
179+
const std::string midicc_names[128] = {
180+
"", // "Bank Select MSB",
181+
"Mod Wheel", //"Modulation Wheel MSB",
182+
"Breath", //"Breath Controller MSB",
183+
"", // "Control 3 MSB",
184+
"Foot", //"Foot Controller MSB",
185+
"Porta Time", //"Portamento Time MSB",
186+
"", //"Data Entry MSB",
187+
"Volume", //"Volume MSB",
188+
"Balance", //"Balance MSB",
189+
"", //"Control 9 MSB",
190+
"Pan", //"Pan MSB",
191+
"Expression", //"Expression MSB",
192+
"", // Effect #1 MSB",
193+
"", // "Effect #2 MSB",
194+
"", // "Control 14 MSB",
195+
"", // "Control 15 MSB",
196+
"", // "General Purpose Controller #1 MSB",
197+
"", // "General Purpose Controller #2 MSB",
198+
"", // "General Purpose Controller #3 MSB",
199+
"", // "General Purpose Controller #4 MSB",
200+
"", // "Control 20 MSB",
201+
"", // "Control 21 MSB",
202+
"", // "Control 22 MSB",
203+
"", // "Control 23 MSB",
204+
"", // "Control 24 MSB",
205+
"", // "Control 25 MSB",
206+
"", // "Control 26 MSB",
207+
"", // "Control 27 MSB",
208+
"", // "Control 28 MSB",
209+
"", // "Control 29 MSB",
210+
"", // "Control 30 MSB",
211+
"", // "Control 31 MSB",
212+
"", // "Bank Select LSB",
213+
"", // "Modulation Wheel LSB",
214+
"", // "Breath Controller LSB",
215+
"", // "Control 3 LSB",
216+
"", // "Foot Controller LSB",
217+
"", // "Portamento Time LSB",
218+
"", // "Data Entry LSB",
219+
"", // "Volume LSB",
220+
"", // "Balance LSB",
221+
"", // "Control 9 LSB",
222+
"", // "Pan LSB",
223+
"", // "Expression LSB",
224+
"", // "Effect #1 LSB",
225+
"", // "Effect #2 LSB",
226+
"", // "Control 14 LSB",
227+
"", // "Control 15 LSB",
228+
"", // "General Purpose Controller #1 LSB",
229+
"", // "General Purpose Controller #2 LSB",
230+
"", // "General Purpose Controller #3 LSB",
231+
"", // "General Purpose Controller #4 LSB",
232+
"", // "Control 20 LSB",
233+
"", // "Control 21 LSB",
234+
"", // "Control 22 LSB",
235+
"", // "Control 23 LSB",
236+
"", // "Control 24 LSB",
237+
"", // "Control 25 LSB",
238+
"", // "Control 26 LSB",
239+
"", // "Control 27 LSB",
240+
"", // "Control 28 LSB",
241+
"", // "Control 29 LSB",
242+
"", // "Control 30 LSB",
243+
"", // "Control 31 LSB",
244+
"Sustain Pedal",
245+
"Portamento Pedal",
246+
"Sostenuto Pedal",
247+
"Soft Pedal",
248+
"Legato Pedal",
249+
"Hold Pedal",
250+
"", // "Sound Control #1 Sound Variation",
251+
"", // "Sound Control #2 Timbre",
252+
"", // "Sound Control #3 Release Time",
253+
"", // "Sound Control #4 Attack Time",
254+
"", // "Sound Control #5 Brightness / MPE Timbre",
255+
"", // "Sound Control #6 Decay Time",
256+
"", // "Sound Control #7 Vibrato Rate",
257+
"", // "Sound Control #8 Vibrato Depth",
258+
"", // "Sound Control #9 Vibrato Delay",
259+
"", // "Sound Control #10 Control 79",
260+
"", // "General Purpose Controller #5",
261+
"", // "General Purpose Controller #6",
262+
"", // "General Purpose Controller #7",
263+
"", // "General Purpose Controller #8",
264+
"", // "Portamento Control",
265+
"", // "Control 85",
266+
"", // "Control 86",
267+
"", // "Control 87",
268+
"", // "High Resolution Velocity Prefix",
269+
"", // "Control 89",
270+
"", // "Control 90",
271+
"", // "Reverb Send Level",
272+
"", // "Tremolo Depth",
273+
"", // "Chorus Send Level",
274+
"", // "Celeste Depth",
275+
"", // "Phaser Depth",
276+
"", // "Data Increment",
277+
"", // "Data Decrement",
278+
"", // "NRPN LSB",
279+
"", // "NRPN MSB",
280+
"", // "RPN LSB",
281+
"", // "RPN MLSB",
282+
"", // "Control 102",
283+
"", // "Control 103",
284+
"", // "Control 104",
285+
"", // "Control 105",
286+
"", // "Control 106",
287+
"", // "Control 107",
288+
"", // "Control 108",
289+
"", // "Control 109",
290+
"", // "Control 110",
291+
"", // "Control 111",
292+
"", // "Control 112",
293+
"", // "Control 113",
294+
"", // "Control 114",
295+
"", // "Control 115",
296+
"", // "Control 116",
297+
"", // "Control 117",
298+
"", // "Control 118",
299+
"", // "Control 119",
300+
"All Sound Off", // "Control 120 All Sound Off",
301+
"", // "Control 121 Reset All Controllers",
302+
"", // "Control 122 Local Control On/Off",
303+
"All Notes Off", //"Control 123 All Notes Off",
304+
"", // "Control 124 Omni Mode Off",
305+
"", // "Control 125 Omni Mode On",
306+
"", // "Control 126 Mono Mode Off",
307+
"", // "Control 127 Mono Mode On"
308+
};
309+
return midicc_names[cc];
310+
}
311+
} // namespace sst::basic_blocks::tables
312+
#endif // MIDI1CCNAMES_H

tests/smoketest.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include "sst/basic-blocks/dsp/Interpolators.h"
3636
#include "sst/basic-blocks/dsp/BlockInterpolators.h"
3737
#include "sst/basic-blocks/dsp/PanLaws.h"
38+
#include "sst/basic-blocks/tables/MIDICCNames.h"
3839

3940
#include "sst/basic-blocks/modulators/ADAREnvelope.h"
4041
#include "sst/basic-blocks/modulators/ADSREnvelope.h"

0 commit comments

Comments
 (0)