Arduino MIDI Library  Version 4.3.1
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>
36 typedef uint8_t byte;
37 #endif
38 
40 
41 #define MIDI_LIBRARY_VERSION 0x040300
42 #define MIDI_LIBRARY_VERSION_MAJOR 4
43 #define MIDI_LIBRARY_VERSION_MINOR 3
44 #define MIDI_LIBRARY_VERSION_PATCH 0
45 
46 // -----------------------------------------------------------------------------
47 
48 #define MIDI_CHANNEL_OMNI 0
49 #define MIDI_CHANNEL_OFF 17 // and over
50 
51 #define MIDI_PITCHBEND_MIN -8192
52 #define MIDI_PITCHBEND_MAX 8191
53 
54 // -----------------------------------------------------------------------------
55 // Type definitions
56 
57 typedef byte StatusByte;
58 typedef byte DataByte;
59 typedef byte Channel;
60 typedef byte FilterMode;
61 
62 // -----------------------------------------------------------------------------
63 
66 {
67  InvalidType = 0x00,
68  NoteOff = 0x80,
69  NoteOn = 0x90,
70  AfterTouchPoly = 0xA0,
71  ControlChange = 0xB0,
72  ProgramChange = 0xC0,
74  PitchBend = 0xE0,
75  SystemExclusive = 0xF0,
77  SongPosition = 0xF2,
78  SongSelect = 0xF3,
79  TuneRequest = 0xF6,
80  Clock = 0xF8,
81  Start = 0xFA,
82  Continue = 0xFB,
83  Stop = 0xFC,
84  ActiveSensing = 0xFE,
85  SystemReset = 0xFF,
86 };
87 
88 // -----------------------------------------------------------------------------
89 
91 struct Thru
92 {
93  enum Mode
94  {
95  Off = 0,
96  Full = 1,
99  };
100 };
101 
105 enum __attribute__ ((deprecated)) MidiFilterMode
106 {
107  Off = Thru::Off,
108  Full = Thru::Full,
111 };
112 
113 // -----------------------------------------------------------------------------
114 
120 {
121  // High resolution Continuous Controllers MSB (+32 for LSB) ----------------
125  // CC3 undefined
130  Balance = 8,
131  // CC9 undefined
132  Pan = 10,
136  // CC14 undefined
137  // CC15 undefined
142 
144 
145  // Switches ----------------------------------------------------------------
146  Sustain = 64,
148  Sostenuto = 66,
149  SoftPedal = 67,
150  Legato = 68,
151  Hold = 69,
152 
153  // Low resolution continuous controllers -----------------------------------
169  // CC85 to CC90 undefined
170  Effects1 = 91,
171  Effects2 = 92,
172  Effects3 = 93,
173  Effects4 = 94,
174  Effects5 = 95,
177  NRPNLSB = 98,
178  NRPNMSB = 99,
179  RPNLSB = 100,
180  RPNMSB = 101,
181 
182  // Channel Mode messages ---------------------------------------------------
183  AllSoundOff = 120,
186  AllNotesOff = 123,
187  OmniModeOff = 124,
188  OmniModeOn = 125,
189  MonoModeOn = 126,
191 };
192 
193 struct RPN
194 {
196  {
197  PitchBendSensitivity = 0x0000,
198  ChannelFineTuning = 0x0001,
199  ChannelCoarseTuning = 0x0002,
200  SelectTuningProgram = 0x0003,
201  SelectTuningBank = 0x0004,
202  ModulationDepthRange = 0x0005,
203  NullFunction = (0x7f << 7) + 0x7f,
204  };
205 };
206 
207 // -----------------------------------------------------------------------------
208 
214 #define MIDI_CREATE_INSTANCE(Type, SerialPort, Name) \
215  midi::MidiInterface<Type> Name((Type&)SerialPort);
216 
217 #if defined(ARDUINO_SAM_DUE) || defined(USBCON)
218  // Leonardo, Due and other USB boards use Serial1 by default.
219  #define MIDI_CREATE_DEFAULT_INSTANCE() \
220  MIDI_CREATE_INSTANCE(HardwareSerial, Serial1, MIDI);
221 #else
222 
226  #define MIDI_CREATE_DEFAULT_INSTANCE() \
227  MIDI_CREATE_INSTANCE(HardwareSerial, Serial, MIDI);
228 #endif
229 
235 #define MIDI_CREATE_CUSTOM_INSTANCE(Type, SerialPort, Name, Settings) \
236  midi::MidiInterface<Type, Settings> Name((Type&)SerialPort);
237 
System Common - Song Position Pointer.
Definition: midi_Defs.h:77
Polyphonic AfterTouch.
Definition: midi_Defs.h:70
System Common - Song Select.
Definition: midi_Defs.h:78
Definition: midi_Defs.h:193
Non-Registered Parameter Number (MSB)
Definition: midi_Defs.h:178
Reverb send level.
Definition: midi_Defs.h:170
System Exclusive.
Definition: midi_Defs.h:75
System Real Time - Stop.
Definition: midi_Defs.h:83
System Real Time - Timing Clock.
Definition: midi_Defs.h:80
byte StatusByte
Definition: midi_Defs.h:57
#define BEGIN_MIDI_NAMESPACE
Mode
Definition: midi_Defs.h:93
System Common - MIDI Time Code Quarter Frame.
Definition: midi_Defs.h:76
Thru disabled (nothing passes through).
Definition: midi_Defs.h:95
#define END_MIDI_NAMESPACE
For notifying errors.
Definition: midi_Defs.h:67
RegisteredParameterNumbers
Definition: midi_Defs.h:195
Only the messages on the Input Channel will be sent back.
Definition: midi_Defs.h:97
Channel (monophonic) AfterTouch.
Definition: midi_Defs.h:73
Program Change.
Definition: midi_Defs.h:72
Synth: Sound Variation FX: Exciter On/Off.
Definition: midi_Defs.h:154
Non-Registered Parameter Number (LSB)
Definition: midi_Defs.h:177
byte Channel
Definition: midi_Defs.h:59
System Real Time - Continue.
Definition: midi_Defs.h:82
Synth: Release Time FX: Distortion On/Off.
Definition: midi_Defs.h:156
Synth: Attack Time FX: EQ On/Off.
Definition: midi_Defs.h:157
System Real Time - Start.
Definition: midi_Defs.h:81
MIDI Library for the Arduino - Namespace declaration.
Registered Parameter Number (MSB)
Definition: midi_Defs.h:180
enum __attribute__((deprecated)) MidiFilterMode
Definition: midi_Defs.h:105
Chorus send level.
Definition: midi_Defs.h:172
Synth: Harmonic Content FX: Compressor On/Off.
Definition: midi_Defs.h:155
byte FilterMode
Definition: midi_Defs.h:60
Note On.
Definition: midi_Defs.h:69
MidiType
Definition: midi_Defs.h:65
Control Change / Channel Mode.
Definition: midi_Defs.h:71
System Common - Tune Request.
Definition: midi_Defs.h:79
Definition: midi_Defs.h:91
Pitch Bend.
Definition: midi_Defs.h:74
byte DataByte
Definition: midi_Defs.h:58
uint8_t byte
Definition: midi_Defs.h:36
Celeste depth.
Definition: midi_Defs.h:173
Synth: Vibrato Rate FX: Delay On/Off.
Definition: midi_Defs.h:160
Tremolo depth.
Definition: midi_Defs.h:171
Synth: Decay Time FX: Reverb On/Off.
Definition: midi_Defs.h:159
All the messages but the ones on the Input Channel will be sent back.
Definition: midi_Defs.h:98
Phaser depth.
Definition: midi_Defs.h:174
Synth: Brightness FX: Expander On/Off.
Definition: midi_Defs.h:158
System Real Time - Active Sensing.
Definition: midi_Defs.h:84
Fully enabled Thru (every incoming message is sent back).
Definition: midi_Defs.h:96
MidiControlChangeNumber
Enumeration of Control Change command numbers. See the detailed controllers numbers & description her...
Definition: midi_Defs.h:119
Note Off.
Definition: midi_Defs.h:68
System Real Time - System Reset.
Definition: midi_Defs.h:85
Definition: midi_Defs.h:132
Synth: Undefined FX: Special Effects On/Off.
Definition: midi_Defs.h:163
Synth: Vibrato Depth FX: Pitch Transpose On/Off.
Definition: midi_Defs.h:161
Registered Parameter Number (LSB)
Definition: midi_Defs.h:179
Synth: Vibrato Delay FX: Flange/Chorus On/Off.
Definition: midi_Defs.h:162