FastLED 3.9.7
Loading...
Searching...
No Matches
midi_Defs.h
Go to the documentation of this file.
1
28#pragma once
29
30#include "midi_Namespace.h"
31
32#if ARDUINO
33#include <Arduino.h>
34#else
35#include <inttypes.h>
36typedef uint8_t byte;
37#endif
38
39BEGIN_MIDI_NAMESPACE
40
41// -----------------------------------------------------------------------------
42
43#define MIDI_CHANNEL_OMNI 0
44#define MIDI_CHANNEL_OFF 17 // and over
45
46#define MIDI_PITCHBEND_MIN -8192
47#define MIDI_PITCHBEND_MAX 8191
48
51static const uint16_t ActiveSensingTimeout = 300;
52
53// -----------------------------------------------------------------------------
54// Type definitions
55
56typedef byte StatusByte;
57typedef byte DataByte;
58typedef byte Channel;
59typedef byte FilterMode;
60
61// -----------------------------------------------------------------------------
62// Errors
63static const uint8_t ErrorParse = 0;
64static const uint8_t ErrorActiveSensingTimeout = 1;
65static const uint8_t WarningSplitSysEx = 2;
66
67// -----------------------------------------------------------------------------
68// Aliasing
69
70using ErrorCallback = void (*)(int8_t);
71using NoteOffCallback = void (*)(Channel channel, byte note, byte velocity);
72using NoteOnCallback = void (*)(Channel channel, byte note, byte velocity);
73using AfterTouchPolyCallback = void (*)(Channel channel, byte note, byte velocity);
74using ControlChangeCallback = void (*)(Channel channel, byte, byte);
75using ProgramChangeCallback = void (*)(Channel channel, byte);
76using AfterTouchChannelCallback = void (*)(Channel channel, byte);
77using PitchBendCallback = void (*)(Channel channel, int);
78using SystemExclusiveCallback = void (*)(byte * array, unsigned size);
79using TimeCodeQuarterFrameCallback = void (*)(byte data);
80using SongPositionCallback = void (*)(unsigned beats);
81using SongSelectCallback = void (*)(byte songnumber);
82using TuneRequestCallback = void (*)(void);
83using ClockCallback = void (*)(void);
84using StartCallback = void (*)(void);
85using TickCallback = void (*)(void);
86using ContinueCallback = void (*)(void);
87using StopCallback = void (*)(void);
88using ActiveSensingCallback = void (*)(void);
89using SystemResetCallback = void (*)(void);
90
91// -----------------------------------------------------------------------------
92
94enum MidiType: uint8_t
95{
96 InvalidType = 0x00,
97 NoteOff = 0x80,
98 NoteOn = 0x90,
103 PitchBend = 0xE0,
108 SongSelect = 0xF3,
109 Undefined_F4 = 0xF4,
110 Undefined_F5 = 0xF5,
111 TuneRequest = 0xF6,
113 Clock = 0xF8,
114 Undefined_F9 = 0xF9,
115 Tick = Undefined_F9,
116 Start = 0xFA,
117 Continue = 0xFB,
118 Stop = 0xFC,
119 Undefined_FD = 0xFD,
121 SystemReset = 0xFF,
122};
123
124// -----------------------------------------------------------------------------
125
127struct Thru
128{
129 enum Mode
130 {
131 Off = 0,
132 Full = 1,
135 };
136};
137
138// -----------------------------------------------------------------------------
139
145{
146 // High resolution Continuous Controllers MSB (+32 for LSB) ----------------
147 BankSelect = 0,
148 ModulationWheel = 1,
149 BreathController = 2,
150 // CC3 undefined
151 FootController = 4,
152 PortamentoTime = 5,
153 DataEntryMSB = 6,
154 ChannelVolume = 7,
155 Balance = 8,
156 // CC9 undefined
157 Pan = 10,
158 ExpressionController = 11,
159 EffectControl1 = 12,
160 EffectControl2 = 13,
161 // CC14 undefined
162 // CC15 undefined
163 GeneralPurposeController1 = 16,
164 GeneralPurposeController2 = 17,
165 GeneralPurposeController3 = 18,
166 GeneralPurposeController4 = 19,
167
168 DataEntryLSB = 38,
169
170 // Switches ----------------------------------------------------------------
171 Sustain = 64,
172 Portamento = 65,
173 Sostenuto = 66,
174 SoftPedal = 67,
175 Legato = 68,
176 Hold = 69,
177
178 // Low resolution continuous controllers -----------------------------------
189 GeneralPurposeController5 = 80,
190 GeneralPurposeController6 = 81,
191 GeneralPurposeController7 = 82,
192 GeneralPurposeController8 = 83,
193 PortamentoControl = 84,
194 // CC85 to CC90 undefined
195 Effects1 = 91,
196 Effects2 = 92,
197 Effects3 = 93,
198 Effects4 = 94,
199 Effects5 = 95,
200 DataIncrement = 96,
201 DataDecrement = 97,
202 NRPNLSB = 98,
203 NRPNMSB = 99,
204 RPNLSB = 100,
205 RPNMSB = 101,
206
207 // Channel Mode messages ---------------------------------------------------
208 AllSoundOff = 120,
209 ResetAllControllers = 121,
210 LocalControl = 122,
211 AllNotesOff = 123,
212 OmniModeOff = 124,
213 OmniModeOn = 125,
214 MonoModeOn = 126,
215 PolyModeOn = 127
216};
217
218struct RPN
219{
220 enum RegisteredParameterNumbers: uint16_t
221 {
222 PitchBendSensitivity = 0x0000,
223 ChannelFineTuning = 0x0001,
224 ChannelCoarseTuning = 0x0002,
225 SelectTuningProgram = 0x0003,
226 SelectTuningBank = 0x0004,
227 ModulationDepthRange = 0x0005,
228 NullFunction = (0x7f << 7) + 0x7f,
229 };
230};
231
232END_MIDI_NAMESPACE
MidiControlChangeNumber
Enumeration of Control Change command numbers. See the detailed controllers numbers & description her...
Definition midi_Defs.h:145
@ RPNLSB
Registered Parameter Number (LSB)
Definition midi_Defs.h:204
@ Effects5
Phaser depth.
Definition midi_Defs.h:199
@ SoundController5
Synth: Brightness FX: Expander On/Off.
Definition midi_Defs.h:183
@ RPNMSB
Registered Parameter Number (MSB)
Definition midi_Defs.h:205
@ SoundController4
Synth: Attack Time FX: EQ On/Off.
Definition midi_Defs.h:182
@ NRPNLSB
Non-Registered Parameter Number (LSB)
Definition midi_Defs.h:202
@ SoundController9
Synth: Vibrato Delay FX: Flange/Chorus On/Off.
Definition midi_Defs.h:187
@ NRPNMSB
Non-Registered Parameter Number (MSB)
Definition midi_Defs.h:203
@ SoundController10
Synth: Undefined FX: Special Effects On/Off.
Definition midi_Defs.h:188
@ Effects4
Celeste depth.
Definition midi_Defs.h:198
@ SoundController6
Synth: Decay Time FX: Reverb On/Off.
Definition midi_Defs.h:184
@ Effects2
Tremolo depth.
Definition midi_Defs.h:196
@ SoundController8
Synth: Vibrato Depth FX: Pitch Transpose On/Off.
Definition midi_Defs.h:186
@ Effects3
Chorus send level.
Definition midi_Defs.h:197
@ SoundController2
Synth: Harmonic Content FX: Compressor On/Off.
Definition midi_Defs.h:180
@ SoundController1
Synth: Sound Variation FX: Exciter On/Off.
Definition midi_Defs.h:179
@ SoundController7
Synth: Vibrato Rate FX: Delay On/Off.
Definition midi_Defs.h:185
@ Effects1
Reverb send level.
Definition midi_Defs.h:195
@ SoundController3
Synth: Release Time FX: Distortion On/Off.
Definition midi_Defs.h:181
MidiType
Definition midi_Defs.h:95
@ AfterTouchChannel
Channel Message - Channel (monophonic) AfterTouch.
Definition midi_Defs.h:102
@ ProgramChange
Channel Message - Program Change.
Definition midi_Defs.h:101
@ SystemExclusiveStart
System Exclusive Start.
Definition midi_Defs.h:105
@ Continue
System Real Time - Continue.
Definition midi_Defs.h:117
@ Clock
System Real Time - Timing Clock.
Definition midi_Defs.h:113
@ ActiveSensing
System Real Time - Active Sensing.
Definition midi_Defs.h:120
@ SystemReset
System Real Time - System Reset.
Definition midi_Defs.h:121
@ SystemExclusive
System Exclusive.
Definition midi_Defs.h:104
@ InvalidType
For notifying errors.
Definition midi_Defs.h:96
@ SongPosition
System Common - Song Position Pointer.
Definition midi_Defs.h:107
@ Tick
System Real Time - Timing Tick (1 tick = 10 milliseconds)
Definition midi_Defs.h:115
@ TuneRequest
System Common - Tune Request.
Definition midi_Defs.h:111
@ Start
System Real Time - Start.
Definition midi_Defs.h:116
@ ControlChange
Channel Message - Control Change / Channel Mode.
Definition midi_Defs.h:100
@ PitchBend
Channel Message - Pitch Bend.
Definition midi_Defs.h:103
@ NoteOff
Channel Message - Note Off.
Definition midi_Defs.h:97
@ SongSelect
System Common - Song Select.
Definition midi_Defs.h:108
@ SystemExclusiveEnd
System Exclusive End.
Definition midi_Defs.h:112
@ AfterTouchPoly
Channel Message - Polyphonic AfterTouch.
Definition midi_Defs.h:99
@ Stop
System Real Time - Stop.
Definition midi_Defs.h:118
@ TimeCodeQuarterFrame
System Common - MIDI Time Code Quarter Frame.
Definition midi_Defs.h:106
@ NoteOn
Channel Message - Note On.
Definition midi_Defs.h:98
MIDI Library for the Arduino - Namespace declaration.
@ DifferentChannel
All the messages but the ones on the Input Channel will be sent back.
Definition midi_Defs.h:134
@ Full
Fully enabled Thru (every incoming message is sent back).
Definition midi_Defs.h:132
@ Off
Thru disabled (nothing passes through).
Definition midi_Defs.h:131
@ SameChannel
Only the messages on the Input Channel will be sent back.
Definition midi_Defs.h:133