Update map documentation
[openttd-joker.git] / src / music / midi.h
blob473f7f18bb2bd497f41a53f1469d649f02e261a8
1 /* $Id$ */
3 /*
4 * This file is part of OpenTTD.
5 * 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.
6 * 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.
7 * 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 */
10 /* @file midi.h Declarations for MIDI data */
12 #ifndef MUSIC_MIDI_H
13 #define MUSIC_MIDI_H
15 #include "../stdafx.h"
17 /** Header of a Stanard MIDI File */
18 struct SMFHeader {
19 uint16 format;
20 uint16 tracks;
21 uint16 tickdiv;
24 /** MIDI status byte codes */
25 enum MidiStatus {
26 /* Bytes with top bit unset are data bytes i.e. not status bytes */
27 /* Channel status messages, require channel number in lower nibble */
28 MIDIST_NOTEOFF = 0x80,
29 MIDIST_NOTEON = 0x90,
30 MIDIST_POLYPRESS = 0xA0,
31 MIDIST_CONTROLLER = 0xB0,
32 MIDIST_PROGCHG = 0xC0,
33 MIDIST_CHANPRESS = 0xD0,
34 MIDIST_PITCHBEND = 0xE0,
35 /* Full byte status messages */
36 MIDIST_SYSEX = 0xF0,
37 MIDIST_TC_QFRAME = 0xF1,
38 MIDIST_SONGPOSPTR = 0xF2,
39 MIDIST_SONGSEL = 0xF3,
40 /* not defined: 0xF4, */
41 /* not defined: 0xF5, */
42 MIDIST_TUNEREQ = 0xF6,
43 MIDIST_ENDSYSEX = 0xF7, ///< only occurs in realtime data
44 MIDIST_SMF_ESCAPE = 0xF7, ///< only occurs in SMF data
45 MIDIST_RT_CLOCK = 0xF8,
46 /* not defined: 0xF9, */
47 MIDIST_RT_START = 0xFA,
48 MIDIST_RT_CONTINUE = 0xFB,
49 MIDIST_RT_STOP = 0xFC,
50 /* not defined: 0xFD, */
51 MIDIST_RT_ACTSENS = 0xFE,
52 MIDIST_SYSRESET = 0xFF, ///< only occurs in realtime data
53 MIDIST_SMF_META = 0xFF, ///< only occurs in SMF data
56 /**
57 * MIDI controller numbers.
58 * Complete list per General MIDI, missing values are not defined.
60 enum MidiController {
61 /* Standard continuous controllers (MSB control) */
62 MIDICT_BANKSELECT = 0,
63 MIDICT_MODWHEEL = 1,
64 MIDICT_BREATH = 2,
65 MIDICT_FOOT = 4,
66 MIDICT_PORTAMENTO = 5,
67 MIDICT_DATAENTRY = 6,
68 MIDICT_CHANVOLUME = 7,
69 MIDICT_BALANCE = 8,
70 MIDICT_PAN = 10,
71 MIDICT_EXPRESSION = 11,
72 MIDICT_EFFECT1 = 12,
73 MIDICT_EFFECT2 = 13,
74 MIDICT_GENERAL1 = 16,
75 MIDICT_GENERAL2 = 17,
76 MIDICT_GENERAL3 = 18,
77 MIDICT_GENERAL4 = 19,
78 /* Offset from MSB to LSB of continuous controllers */
79 MIDICTOFS_HIGHRES = 32,
80 /* Stanard continuous controllers (LSB control) */
81 MIDICT_BANKSELECT_LO = MIDICTOFS_HIGHRES + MIDICT_BANKSELECT,
82 MIDICT_MODWHEEL_LO = MIDICTOFS_HIGHRES + MIDICT_MODWHEEL,
83 MIDICT_BREATH_LO = MIDICTOFS_HIGHRES + MIDICT_BREATH,
84 MIDICT_FOOT_LO = MIDICTOFS_HIGHRES + MIDICT_FOOT,
85 MIDICT_PORTAMENTO_LO = MIDICTOFS_HIGHRES + MIDICT_PORTAMENTO,
86 MIDICT_DATAENTRY_LO = MIDICTOFS_HIGHRES + MIDICT_DATAENTRY,
87 MIDICT_CHANVOLUME_LO = MIDICTOFS_HIGHRES + MIDICT_CHANVOLUME,
88 MIDICT_BALANCE_LO = MIDICTOFS_HIGHRES + MIDICT_BALANCE,
89 MIDICT_PAN_LO = MIDICTOFS_HIGHRES + MIDICT_PAN,
90 MIDICT_EXPRESSION_LO = MIDICTOFS_HIGHRES + MIDICT_EXPRESSION,
91 MIDICT_EFFECT1_LO = MIDICTOFS_HIGHRES + MIDICT_EFFECT1,
92 MIDICT_EFFECT2_LO = MIDICTOFS_HIGHRES + MIDICT_EFFECT2,
93 MIDICT_GENERAL1_LO = MIDICTOFS_HIGHRES + MIDICT_GENERAL1,
94 MIDICT_GENERAL2_LO = MIDICTOFS_HIGHRES + MIDICT_GENERAL2,
95 MIDICT_GENERAL3_LO = MIDICTOFS_HIGHRES + MIDICT_GENERAL3,
96 MIDICT_GENERAL4_LO = MIDICTOFS_HIGHRES + MIDICT_GENERAL4,
97 /* Switch controllers */
98 MIDICT_SUSTAINSW = 64,
99 MIDICT_PORTAMENTOSW = 65,
100 MIDICT_SOSTENUTOSW = 66,
101 MIDICT_SOFTPEDALSW = 67,
102 MIDICT_LEGATOSW = 68,
103 MIDICT_HOLD2SW = 69,
104 /* Standard low-resolution controllers */
105 MIDICT_SOUND1 = 70,
106 MIDICT_SOUND2 = 71,
107 MIDICT_SOUND3 = 72,
108 MIDICT_SOUND4 = 73,
109 MIDICT_SOUND5 = 74,
110 MIDICT_SOUND6 = 75,
111 MIDICT_SOUND7 = 76,
112 MIDICT_SOUND8 = 77,
113 MIDICT_SOUND9 = 78,
114 MIDICT_SOUND10 = 79,
115 MIDICT_GENERAL5 = 80,
116 MIDICT_GENERAL6 = 81,
117 MIDICT_GENERAL7 = 82,
118 MIDICT_GENERAL8 = 83,
119 MIDICT_PORTAMENTOCTL = 84,
120 MIDICT_PRF_HIGHRESVEL = 88,
121 MIDICT_EFFECTS1 = 91,
122 MIDICT_EFFECTS2 = 92,
123 MIDICT_EFFECTS3 = 93,
124 MIDICT_EFFECTS4 = 94,
125 MIDICT_EFFECTS5 = 95,
126 /* Registered/unregistered parameters control */
127 MIDICT_DATA_INCREMENT = 96,
128 MIDICT_DATA_DECREMENT = 97,
129 MIDICT_NRPN_SELECT_LO = 98,
130 MIDICT_NRPN_SELECT_HI = 99,
131 MIDICT_RPN_SELECT_LO = 100,
132 MIDICT_RPN_SELECT_HI = 101,
133 /* Channel mode messages */
134 MIDICT_MODE_ALLSOUNDOFF = 120,
135 MIDICT_MODE_RESETALLCTRL = 121,
136 MIDICT_MODE_LOCALCTL = 122,
137 MIDICT_MODE_ALLNOTESOFF = 123,
138 MIDICT_MODE_OMNI_OFF = 124,
139 MIDICT_MODE_OMNI_ON = 125,
140 MIDICT_MODE_MONO = 126,
141 MIDICT_MODE_POLY = 127,
144 #endif /* MUSIC_MIDI_H */