2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
8 /* @file midi.h Declarations for MIDI data */
13 #include "../stdafx.h"
15 /** Header of a Stanard MIDI File */
22 /** MIDI status byte codes */
24 /* Bytes with top bit unset are data bytes i.e. not status bytes */
25 /* Channel status messages, require channel number in lower nibble */
26 MIDIST_NOTEOFF
= 0x80,
28 MIDIST_POLYPRESS
= 0xA0,
29 MIDIST_CONTROLLER
= 0xB0,
30 MIDIST_PROGCHG
= 0xC0,
31 MIDIST_CHANPRESS
= 0xD0,
32 MIDIST_PITCHBEND
= 0xE0,
33 /* Full byte status messages */
35 MIDIST_TC_QFRAME
= 0xF1,
36 MIDIST_SONGPOSPTR
= 0xF2,
37 MIDIST_SONGSEL
= 0xF3,
38 /* not defined: 0xF4, */
39 /* not defined: 0xF5, */
40 MIDIST_TUNEREQ
= 0xF6,
41 MIDIST_ENDSYSEX
= 0xF7, ///< only occurs in realtime data
42 MIDIST_SMF_ESCAPE
= 0xF7, ///< only occurs in SMF data
43 MIDIST_RT_CLOCK
= 0xF8,
44 /* not defined: 0xF9, */
45 MIDIST_RT_START
= 0xFA,
46 MIDIST_RT_CONTINUE
= 0xFB,
47 MIDIST_RT_STOP
= 0xFC,
48 /* not defined: 0xFD, */
49 MIDIST_RT_ACTSENS
= 0xFE,
50 MIDIST_SYSRESET
= 0xFF, ///< only occurs in realtime data
51 MIDIST_SMF_META
= 0xFF, ///< only occurs in SMF data
55 * MIDI controller numbers.
56 * Complete list per General MIDI, missing values are not defined.
59 /* Standard continuous controllers (MSB control) */
60 MIDICT_BANKSELECT
= 0,
64 MIDICT_PORTAMENTO
= 5,
66 MIDICT_CHANVOLUME
= 7,
69 MIDICT_EXPRESSION
= 11,
76 /* Offset from MSB to LSB of continuous controllers */
77 MIDICTOFS_HIGHRES
= 32,
78 /* Stanard continuous controllers (LSB control) */
79 MIDICT_BANKSELECT_LO
= MIDICTOFS_HIGHRES
+ MIDICT_BANKSELECT
,
80 MIDICT_MODWHEEL_LO
= MIDICTOFS_HIGHRES
+ MIDICT_MODWHEEL
,
81 MIDICT_BREATH_LO
= MIDICTOFS_HIGHRES
+ MIDICT_BREATH
,
82 MIDICT_FOOT_LO
= MIDICTOFS_HIGHRES
+ MIDICT_FOOT
,
83 MIDICT_PORTAMENTO_LO
= MIDICTOFS_HIGHRES
+ MIDICT_PORTAMENTO
,
84 MIDICT_DATAENTRY_LO
= MIDICTOFS_HIGHRES
+ MIDICT_DATAENTRY
,
85 MIDICT_CHANVOLUME_LO
= MIDICTOFS_HIGHRES
+ MIDICT_CHANVOLUME
,
86 MIDICT_BALANCE_LO
= MIDICTOFS_HIGHRES
+ MIDICT_BALANCE
,
87 MIDICT_PAN_LO
= MIDICTOFS_HIGHRES
+ MIDICT_PAN
,
88 MIDICT_EXPRESSION_LO
= MIDICTOFS_HIGHRES
+ MIDICT_EXPRESSION
,
89 MIDICT_EFFECT1_LO
= MIDICTOFS_HIGHRES
+ MIDICT_EFFECT1
,
90 MIDICT_EFFECT2_LO
= MIDICTOFS_HIGHRES
+ MIDICT_EFFECT2
,
91 MIDICT_GENERAL1_LO
= MIDICTOFS_HIGHRES
+ MIDICT_GENERAL1
,
92 MIDICT_GENERAL2_LO
= MIDICTOFS_HIGHRES
+ MIDICT_GENERAL2
,
93 MIDICT_GENERAL3_LO
= MIDICTOFS_HIGHRES
+ MIDICT_GENERAL3
,
94 MIDICT_GENERAL4_LO
= MIDICTOFS_HIGHRES
+ MIDICT_GENERAL4
,
95 /* Switch controllers */
96 MIDICT_SUSTAINSW
= 64,
97 MIDICT_PORTAMENTOSW
= 65,
98 MIDICT_SOSTENUTOSW
= 66,
99 MIDICT_SOFTPEDALSW
= 67,
100 MIDICT_LEGATOSW
= 68,
102 /* Standard low-resolution controllers */
113 MIDICT_GENERAL5
= 80,
114 MIDICT_GENERAL6
= 81,
115 MIDICT_GENERAL7
= 82,
116 MIDICT_GENERAL8
= 83,
117 MIDICT_PORTAMENTOCTL
= 84,
118 MIDICT_PRF_HIGHRESVEL
= 88,
119 MIDICT_EFFECTS1
= 91,
120 MIDICT_EFFECTS2
= 92,
121 MIDICT_EFFECTS3
= 93,
122 MIDICT_EFFECTS4
= 94,
123 MIDICT_EFFECTS5
= 95,
124 /* Registered/unregistered parameters control */
125 MIDICT_DATA_INCREMENT
= 96,
126 MIDICT_DATA_DECREMENT
= 97,
127 MIDICT_NRPN_SELECT_LO
= 98,
128 MIDICT_NRPN_SELECT_HI
= 99,
129 MIDICT_RPN_SELECT_LO
= 100,
130 MIDICT_RPN_SELECT_HI
= 101,
131 /* Channel mode messages */
132 MIDICT_MODE_ALLSOUNDOFF
= 120,
133 MIDICT_MODE_RESETALLCTRL
= 121,
134 MIDICT_MODE_LOCALCTL
= 122,
135 MIDICT_MODE_ALLNOTESOFF
= 123,
136 MIDICT_MODE_OMNI_OFF
= 124,
137 MIDICT_MODE_OMNI_ON
= 125,
138 MIDICT_MODE_MONO
= 126,
139 MIDICT_MODE_POLY
= 127,
143 /** Well-known MIDI system exclusive message values for use with the MidiGetStandardSysexMessage function. */
144 enum class MidiSysexMessage
{
145 /** Reset device to General MIDI defaults */
147 /** Reset device to (Roland) General Standard defaults */
149 /** Reset device to (Yamaha) XG defaults */
151 /** Set up Roland SoundCanvas reverb room as TTD does */
155 const uint8_t *MidiGetStandardSysexMessage(MidiSysexMessage msg
, size_t &length
);
157 #endif /* MUSIC_MIDI_H */