1 /*
2  * Midi.h - constants, structs etc. concerning MIDI
3  *
4  * Copyright (c) 2005-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
5  *
6  * This file is part of LMMS - https://lmms.io
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public
19  * License along with this program (see COPYING); if not, write to the
20  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21  * Boston, MA 02110-1301 USA.
22  *
23  */
24 
25 #ifndef MIDI_H
26 #define MIDI_H
27 
28 #include "lmms_basics.h"
29 
30 
31 enum MidiEventTypes
32 {
33 	// messages
34 	MidiNoteOff = 0x80,
35 	MidiNoteOn = 0x90,
36 	MidiKeyPressure = 0xA0,
37 	MidiControlChange = 0xB0,
38 	MidiProgramChange = 0xC0,
39 	MidiChannelPressure = 0xD0,
40 	MidiPitchBend = 0xE0,
41 	// system exclusive
42 	MidiSysEx= 0xF0,
43 	// system common - never in midi files
44 	MidiTimeCode= 0xF1,
45 	MidiSongPosition = 0xF2,
46 	MidiSongSelect = 0xF3,
47 	MidiTuneRequest = 0xF6,
48 	MidiEOX= 0xF7,
49 	// system real-time - never in midi files
50 	MidiSync = 0xF8,
51 	MidiTick = 0xF9,
52 	MidiStart = 0xFA,
53 	MidiContinue = 0xFB,
54 	MidiStop = 0xFC,
55 	MidiActiveSensing = 0xFE,
56 	MidiSystemReset = 0xFF,
57 	// meta event - for midi files only
58 	MidiMetaEvent = 0xFF
59 } ;
60 
61 enum MidiMetaEventTypes
62 {
63 	MidiMetaInvalid = 0x00,
64 	MidiCopyright = 0x02,
65 	MidiTrackName = 0x03,
66 	MidiInstName = 0x04,
67 	MidiLyric = 0x05,
68 	MidiMarker = 0x06,
69 	MidiCuePoint = 0x07,
70 	MidiPortNumber = 0x21,
71 	MidiEOT = 0x2f,
72 	MidiSetTempo = 0x51,
73 	MidiSMPTEOffset = 0x54,
74 	MidiTimeSignature = 0x58,
75 	MidiKeySignature = 0x59,
76 	MidiSequencerEvent = 0x7f,
77 	MidiMetaCustom = 0x80,
78 	MidiNotePanning
79 } ;
80 typedef MidiMetaEventTypes MidiMetaEventType;
81 
82 
83 enum MidiStandardControllers
84 {
85 	MidiControllerBankSelect = 0,
86 	MidiControllerModulationWheel = 1,
87 	MidiControllerBreathController = 2,
88 	MidiControllerFootController = 4,
89 	MidiControllerPortamentoTime = 5,
90 	MidiControllerDataEntry = 6,
91 	MidiControllerMainVolume = 7,
92 	MidiControllerBalance = 8,
93 	MidiControllerPan = 10,
94 	MidiControllerEffectControl1 = 12,
95 	MidiControllerEffectControl2 = 13,
96 	MidiControllerSustain = 64,
97 	MidiControllerPortamento = 65,
98 	MidiControllerSostenuto = 66,
99 	MidiControllerSoftPedal = 67,
100 	MidiControllerLegatoFootswitch = 68,
101 	MidiControllerRegisteredParameterNumberLSB = 100,
102 	MidiControllerRegisteredParameterNumberMSB = 101,
103 	// Channel Mode Messages are controllers too...
104 	MidiControllerAllSoundOff = 120,
105 	MidiControllerResetAllControllers = 121,
106 	MidiControllerLocalControl = 122,
107 	MidiControllerAllNotesOff = 123,
108 	MidiControllerOmniOn = 124,
109 	MidiControllerOmniOff = 125,
110 	MidiControllerMonoOn = 126,
111 	MidiControllerPolyOn = 127,
112 
113 };
114 
115 enum MidiControllerRegisteredParameterNumbers
116 {
117 	MidiPitchBendSensitivityRPN = 0x0000,
118 	MidiChannelFineTuningRPN = 0x0001,
119 	MidiChannelCoarseTuningRPN = 0x0002,
120 	MidiTuningProgramChangeRPN = 0x0003,
121 	MidiTuningBankSelectRPN = 0x0004,
122 	MidiModulationDepthRangeRPN = 0x0005,
123 	MidiNullFunctionNumberRPN = 0x7F7F
124 };
125 
126 const int MidiChannelCount = 16;
127 const int MidiControllerCount = 128;
128 const int MidiProgramCount = 128;
129 const int MidiMaxVelocity = 127;
130 const int MidiDefaultVelocity = MidiMaxVelocity / 2;
131 const int MidiMaxControllerValue = 127;
132 const int MidiMaxKey = 127;
133 
134 const int MidiMaxPanning = 127;
135 const int MidiMinPanning = -128;
136 
137 const int MidiMinPitchBend = 0;
138 const int MidiMaxPitchBend = 16383;
139 
140 #endif
141