XX CMake Package
Loading...
Searching...
No Matches
XXMidiCommon.h
Go to the documentation of this file.
1#ifndef XXMidiCommonH
2#define XXMidiCommonH
3
4#include "XXMusicExportDef.h"
5
6#include <QList>
7
8namespace XX
9{
11 using Bytes = QList<uchar>;
12
14 Bytes& operator<<(Bytes& data, const uchar& byte);
15
16 namespace Midi
17 {
19 using Channel = uchar; // channels from 1 to 16
20
22 using Velocity = uchar;
23
25 using SongPosition = uint16_t;
26
28 using MessageList = QList<Bytes>;
29
32
33 enum Event : uchar
34 {
35 Unknown = 0x00,
36 // non system events
37 NoteOff = 0x80,
38 NoteOn = 0x90,
43 PitchBend = 0xE0,
44 // system common
45 System = 0xF0,
48 SongSelect = 0xF3,
50 SysExEnd = 0xF7,
51 // system real time
52 Clock = 0xF8,
53 UndefinedA = 0xF9,
54 Start = 0xFA,
55 Continue = 0xFB,
56 Stop = 0xFC,
57 UndefinedB = 0xFD,
59 Reset = 0xFF,
60 Meta = 0xFF // for midi files
61
62 };
63
66
68 {
69 static constexpr uchar EducationalUse = 0x7D;
70 };
71
74
75 enum MetaEvent : uchar // for midi files
76 {
77 MetaUnkown = 0x00,
78 Text = 0x01,
79 Copyright = 0x02,
80 TrackName = 0x03,
82 Lyric = 0x05,
83 Marker = 0x06,
84 CuePoint = 0x07,
86 MidiPort = 0x21,
87 EndOfTrack = 0x2f,
88 LiveTag = 0x48,
89 Tempo = 0x51,
93 };
94
97
98 enum ControllerMessage : uchar //
99 {
101 ModWheel = 0x01,
106 Balance = 0x08,
107 Pan = 0x0A,
111 // START undefined in standard
116 DataInit = 0x18,
117 DataBlock = 0x19,
118 DataApply = 0x1A,
124 // END undefined in standard
127 Sostenuto = 0x42,
128 SoftPedal = 0x42,
130 // START undefined in standard
131 User01 = 0x66,
132 User02 = 0x67,
133 User03 = 0x68,
134 User04 = 0x69,
135 User05 = 0x6A,
136 User06 = 0x6B,
137 User07 = 0x6C,
138 User08 = 0x6D,
139 User09 = 0x6E,
140 User10 = 0x6F,
141 User11 = 0x70,
142 User12 = 0x71,
143 User13 = 0x72,
144 User14 = 0x73,
145 User15 = 0x74,
146 User16 = 0x75,
147 User17 = 0x76,
148 User18 = 0x77,
149 // END undefined in standard
153 };
154
157 enum class Playback : uchar
158 {
162 };
163
164 struct Device
165 {
168 enum Channel : uchar
169 {
178 Daisy = 9,
182 BitBox = 13,
186 // the splitter does not have a midi channel
188 // do not send data to these devices
189 VCMC = 100,
190 ACDC = 101,
192 };
193 };
194
197
199 {
200 // see https://ccrma.stanford.edu/~gary/controllers/midi.html
201 static constexpr float msPerByte = 1000.0f / 3125.0f; // -> 3125 bytes per second
202 };
203
204 // utilities
205
207 XXMUSIC_DECLSPEC bool isEvent(const uchar value, const Midi::Event mask);
208
210 XXMUSIC_DECLSPEC bool hasFirstBit(const uchar value);
211
213 XXMUSIC_DECLSPEC uchar removeFirstBit(const uchar value);
214
215 } // namespace Midi
216} // namespace XX
217
218#endif // XXMidiCommonH
#define XXMUSIC_DECLSPEC
Definition XXMusicExportDef.h:11
bool hasFirstBit(const uchar value)
ControllerMessage
midi control messages
Definition XXMidiCommon.h:99
uchar Velocity
Definition XXMidiCommon.h:22
Channel
midi channels for supported devices
Definition XXMidiCommon.h:169
MetaEvent
midi meta events
Definition XXMidiCommon.h:76
Playback
midi playback states
Definition XXMidiCommon.h:158
uchar removeFirstBit(const uchar value)
Event
midi events
Definition XXMidiCommon.h:34
QList< Bytes > MessageList
Definition XXMidiCommon.h:28
QList< uchar > Bytes
Definition XXMidiCommon.h:11
bool isEvent(const uchar value, const Midi::Event mask)
uchar Channel
Definition XXMidiCommon.h:19
uint16_t SongPosition
Definition XXMidiCommon.h:25
@ ModWheel
Definition XXMidiCommon.h:101
@ User10
Definition XXMidiCommon.h:140
@ ResetAllControlers
Definition XXMidiCommon.h:151
@ RememberInit
Definition XXMidiCommon.h:112
@ User13
Definition XXMidiCommon.h:143
@ Balance
Definition XXMidiCommon.h:106
@ User01
Definition XXMidiCommon.h:131
@ User17
Definition XXMidiCommon.h:147
@ ExpressionController
Definition XXMidiCommon.h:108
@ RememberBlock
Definition XXMidiCommon.h:113
@ AllSoundsOff
Definition XXMidiCommon.h:150
@ User06
Definition XXMidiCommon.h:136
@ DataApply
Definition XXMidiCommon.h:118
@ RememberApply
Definition XXMidiCommon.h:114
@ User09
Definition XXMidiCommon.h:139
@ PortamentoTime
Definition XXMidiCommon.h:104
@ RememberRequest
Definition XXMidiCommon.h:115
@ User16
Definition XXMidiCommon.h:146
@ User11
Definition XXMidiCommon.h:141
@ Pan
Definition XXMidiCommon.h:107
@ Undefined08
Definition XXMidiCommon.h:119
@ User04
Definition XXMidiCommon.h:134
@ User18
Definition XXMidiCommon.h:148
@ LegatoSwitch
Definition XXMidiCommon.h:129
@ DamperPedal
Definition XXMidiCommon.h:125
@ Undefined09
Definition XXMidiCommon.h:120
@ User15
Definition XXMidiCommon.h:145
@ Undefined11
Definition XXMidiCommon.h:122
@ DataBlock
Definition XXMidiCommon.h:117
@ EffectControl1
Definition XXMidiCommon.h:109
@ User03
Definition XXMidiCommon.h:133
@ DataInit
Definition XXMidiCommon.h:116
@ User07
Definition XXMidiCommon.h:137
@ FootController
Definition XXMidiCommon.h:103
@ User08
Definition XXMidiCommon.h:138
@ ChannelVolume
Definition XXMidiCommon.h:105
@ User05
Definition XXMidiCommon.h:135
@ User12
Definition XXMidiCommon.h:142
@ User02
Definition XXMidiCommon.h:132
@ AllNotesOff
Definition XXMidiCommon.h:152
@ Undefined10
Definition XXMidiCommon.h:121
@ Portamento
Definition XXMidiCommon.h:126
@ BankSelect
Definition XXMidiCommon.h:100
@ Sostenuto
Definition XXMidiCommon.h:127
@ User14
Definition XXMidiCommon.h:144
@ SoftPedal
Definition XXMidiCommon.h:128
@ BreathController
Definition XXMidiCommon.h:102
@ EffectControl2
Definition XXMidiCommon.h:110
@ Undefined12
Definition XXMidiCommon.h:123
@ DrumTrigger
Definition XXMidiCommon.h:179
@ KeyStep2
Definition XXMidiCommon.h:175
@ Metropolix
Definition XXMidiCommon.h:184
@ KeyStep3
Definition XXMidiCommon.h:176
@ KeyStep4
Definition XXMidiCommon.h:177
@ ToNerdSEQ
Definition XXMidiCommon.h:185
@ ACDC
Definition XXMidiCommon.h:190
@ Daisy
Definition XXMidiCommon.h:178
@ FlameCC
Definition XXMidiCommon.h:181
@ DopeferQuad4
Definition XXMidiCommon.h:173
@ FromNerdSEQ
Definition XXMidiCommon.h:191
@ VCMC
Definition XXMidiCommon.h:189
@ Splitter
Definition XXMidiCommon.h:187
@ DopeferQuad3
Definition XXMidiCommon.h:172
@ VCVRack
Definition XXMidiCommon.h:180
@ BitBox
Definition XXMidiCommon.h:182
@ DopeferQuad2
Definition XXMidiCommon.h:171
@ KeyStep1
Definition XXMidiCommon.h:174
@ DopeferQuad1
Definition XXMidiCommon.h:170
@ BitBoxMicro
Definition XXMidiCommon.h:183
@ InstrumentName
Definition XXMidiCommon.h:81
@ KeySignature
Definition XXMidiCommon.h:92
@ Text
Definition XXMidiCommon.h:78
@ MetaUnkown
Definition XXMidiCommon.h:77
@ EndOfTrack
Definition XXMidiCommon.h:87
@ Copyright
Definition XXMidiCommon.h:79
@ TrackName
Definition XXMidiCommon.h:80
@ LiveTag
Definition XXMidiCommon.h:88
@ TimeSignature
Definition XXMidiCommon.h:91
@ MidiPort
Definition XXMidiCommon.h:86
@ SMPTEOffset
Definition XXMidiCommon.h:90
@ Marker
Definition XXMidiCommon.h:83
@ ChannelPrefix
Definition XXMidiCommon.h:85
@ CuePoint
Definition XXMidiCommon.h:84
@ Tempo
Definition XXMidiCommon.h:89
@ Lyric
Definition XXMidiCommon.h:82
@ PitchBend
Definition XXMidiCommon.h:43
@ ControlChange
Definition XXMidiCommon.h:40
@ ActiveSensinig
Definition XXMidiCommon.h:58
@ Start
Definition XXMidiCommon.h:54
@ Continue
Definition XXMidiCommon.h:55
@ UndefinedA
Definition XXMidiCommon.h:53
@ SongSelect
Definition XXMidiCommon.h:48
@ ChannelPressure
Definition XXMidiCommon.h:42
@ Stop
Definition XXMidiCommon.h:56
@ System
Definition XXMidiCommon.h:45
@ PolyKeyPressure
Definition XXMidiCommon.h:39
@ Clock
Definition XXMidiCommon.h:52
@ Reset
Definition XXMidiCommon.h:59
@ SongPositionPointer
Definition XXMidiCommon.h:47
@ UndefinedB
Definition XXMidiCommon.h:57
@ TuneRequest
Definition XXMidiCommon.h:49
@ ProgrammChange
Definition XXMidiCommon.h:41
@ Meta
Definition XXMidiCommon.h:60
@ SysExEnd
Definition XXMidiCommon.h:50
@ Unknown
Definition XXMidiCommon.h:35
@ NoteOn
Definition XXMidiCommon.h:38
@ QuarterFrame
Definition XXMidiCommon.h:46
@ NoteOff
Definition XXMidiCommon.h:37
Definition XXMidiCommon.h:17
Definition XXPopulatedAbstract.h:11
std::ostream & operator<<(std::ostream &out, const ByteFours &bf)
Definition XXMidiCommon.h:165
midi manufacturer codes
Definition XXMidiCommon.h:68
static constexpr uchar EducationalUse
Definition XXMidiCommon.h:69
common variables and functions for midi handling
Definition XXMidiCommon.h:199
static constexpr float msPerByte
Definition XXMidiCommon.h:201