xref: /haiku/headers/os/midi/MidiDefs.h (revision c34e5f4dd555c3f27d12ca84095239ec8392470d)
1 
2 #ifndef _MIDI_DEFS_H
3 #define _MIDI_DEFS_H
4 
5 #include <OS.h>
6 #include <Errors.h>
7 
8 //------------------------------------------------------------------------------
9 
10 /* System time converted to int milliseconds */
11 #define B_NOW  ((uint32)(system_time()/1000))
12 
13 //------------------------------------------------------------------------------
14 
15 /* Synthesizer things */
16 
17 #define B_SYNTH_DIRECTORY    B_SYSTEM_DATA_DIRECTORY
18 
19 /* Deprecated */
20 #define B_BIG_SYNTH_FILE     "synth/big_synth.sy"
21 #define B_LITTLE_SYNTH_FILE  "synth/little_synth.sy"
22 
23 typedef enum synth_mode
24 {
25 	B_NO_SYNTH,
26 	B_BIG_SYNTH,
27 	B_LITTLE_SYNTH,
28 	B_DEFAULT_SYNTH,
29 	B_SAMPLES_ONLY
30 }
31 synth_mode;
32 
33 //------------------------------------------------------------------------------
34 
35 /* Need to move these into Errors.h */
36 
37 enum
38 {
39 	B_BAD_INSTRUMENT = B_MIDI_ERROR_BASE + 0x100,
40 	B_BAD_MIDI_DATA,
41 	B_ALREADY_PAUSED,
42 	B_ALREADY_RESUMED,
43 	B_NO_SONG_PLAYING,
44 	B_TOO_MANY_SONGS_PLAYING
45 };
46 
47 //------------------------------------------------------------------------------
48 
49 #ifndef uchar
50 typedef unsigned char uchar;
51 #endif
52 
53 #ifndef _MIDI_CONSTANTS_
54 #define _MIDI_CONSTANTS_
55 
56 /* Channel Message Masks*/
57 const uchar B_NOTE_OFF          = 0x80;
58 const uchar B_NOTE_ON           = 0x90;
59 const uchar B_KEY_PRESSURE      = 0xa0;
60 const uchar B_CONTROL_CHANGE    = 0xb0;
61 const uchar B_PROGRAM_CHANGE    = 0xc0;
62 const uchar B_CHANNEL_PRESSURE  = 0xd0;
63 const uchar B_PITCH_BEND        = 0xe0;
64 
65 /* System Messages*/
66 const uchar B_SYS_EX_START		= 0xf0;
67 const uchar B_MIDI_TIME_CODE	= 0xf1;
68 const uchar B_SONG_POSITION		= 0xf2;
69 const uchar B_SONG_SELECT		= 0xf3;
70 const uchar B_CABLE_MESSAGE		= 0xf5;
71 const uchar B_TUNE_REQUEST		= 0xf6;
72 const uchar B_SYS_EX_END		= 0xf7;
73 const uchar B_TIMING_CLOCK		= 0xf8;
74 const uchar B_START				= 0xfa;
75 const uchar B_CONTINUE			= 0xfb;
76 const uchar B_STOP				= 0xfc;
77 const uchar B_ACTIVE_SENSING	= 0xfe;
78 const uchar B_SYSTEM_RESET		= 0xff;
79 
80 /* Controller Numbers*/
81 const uchar B_MODULATION            = 0x01;
82 const uchar B_BREATH_CONTROLLER     = 0x02;
83 const uchar B_FOOT_CONTROLLER       = 0x04;
84 const uchar B_PORTAMENTO_TIME       = 0x05;
85 const uchar B_DATA_ENTRY            = 0x06;
86 const uchar B_MAIN_VOLUME           = 0x07;
87 const uchar B_MIDI_BALANCE          = 0x08;  /* used to be B_BALANCE */
88 const uchar B_PAN                   = 0x0a;
89 const uchar B_EXPRESSION_CTRL       = 0x0b;
90 const uchar B_GENERAL_CTRL_1        = 0x10;
91 const uchar B_GENERAL_CTRL_2        = 0x11;
92 const uchar B_GENERAL_CTRL_3        = 0x12;
93 const uchar B_GENERAL_CTRL_4        = 0x13;
94 const uchar B_SUSTAIN_PEDAL         = 0x40;
95 const uchar B_PORTAMENTO            = 0x41;
96 const uchar B_SOSTENUTO             = 0x42;
97 const uchar B_SOFT_PEDAL            = 0x43;
98 const uchar B_HOLD_2                = 0x45;
99 const uchar B_GENERAL_CTRL_5        = 0x50;
100 const uchar B_GENERAL_CTRL_6        = 0x51;
101 const uchar B_GENERAL_CTRL_7        = 0x52;
102 const uchar B_GENERAL_CTRL_8        = 0x53;
103 const uchar B_EFFECTS_DEPTH         = 0x5b;
104 const uchar B_TREMOLO_DEPTH         = 0x5c;
105 const uchar B_CHORUS_DEPTH          = 0x5d;
106 const uchar B_CELESTE_DEPTH         = 0x5e;
107 const uchar B_PHASER_DEPTH          = 0x5f;
108 const uchar B_DATA_INCREMENT        = 0x60;
109 const uchar B_DATA_DECREMENT        = 0x61;
110 const uchar B_RESET_ALL_CONTROLLERS = 0x79;
111 const uchar B_LOCAL_CONTROL         = 0x7a;
112 const uchar B_ALL_NOTES_OFF         = 0x7b;
113 const uchar B_OMNI_MODE_OFF         = 0x7c;
114 const uchar B_OMNI_MODE_ON          = 0x7d;
115 const uchar B_MONO_MODE_ON          = 0x7e;
116 const uchar B_POLY_MODE_ON          = 0x7f;
117 
118 const uchar B_TEMPO_CHANGE          = 0x51;
119 
120 #endif // _MIDI_CONSTANTS_
121 
122 //------------------------------------------------------------------------------
123 
124 typedef enum midi_axe
125 {
126 	/* Pianos */
127 	B_ACOUSTIC_GRAND=0,
128 	B_BRIGHT_GRAND,
129 	B_ELECTRIC_GRAND,
130 	B_HONKY_TONK,
131 	B_ELECTRIC_PIANO_1,
132 	B_ELECTRIC_PIANO_2,
133 	B_HARPSICHORD,
134 	B_CLAVICHORD,
135 
136 	/* Tuned Idiophones */
137 	B_CELESTA,
138 	B_GLOCKENSPIEL,
139 	B_MUSIC_BOX,
140 	B_VIBRAPHONE,
141 	B_MARIMBA,
142 	B_XYLOPHONE,
143 	B_TUBULAR_BELLS,
144 	B_DULCIMER,
145 
146 	/* Organs */
147 	B_DRAWBAR_ORGAN,
148 	B_PERCUSSIVE_ORGAN,
149 	B_ROCK_ORGAN,
150 	B_CHURCH_ORGAN,
151 	B_REED_ORGAN,
152 	B_ACCORDION,
153 	B_HARMONICA,
154 	B_TANGO_ACCORDION,
155 
156 	/* Guitars */
157 	B_ACOUSTIC_GUITAR_NYLON,
158 	B_ACOUSTIC_GUITAR_STEEL,
159 	B_ELECTRIC_GUITAR_JAZZ,
160 	B_ELECTRIC_GUITAR_CLEAN,
161 	B_ELECTRIC_GUITAR_MUTED,
162 	B_OVERDRIVEN_GUITAR,
163 	B_DISTORTION_GUITAR,
164 	B_GUITAR_HARMONICS,
165 
166 	/* Basses */
167 	B_ACOUSTIC_BASS,
168 	B_ELECTRIC_BASS_FINGER,
169 	B_ELECTRIC_BASS_PICK,
170 	B_FRETLESS_BASS,
171 	B_SLAP_BASS_1,
172 	B_SLAP_BASS_2,
173 	B_SYNTH_BASS_1,
174 	B_SYNTH_BASS_2,
175 
176 	/* Strings */
177 	B_VIOLIN,
178 	B_VIOLA,
179 	B_CELLO,
180 	B_CONTRABASS,
181 	B_TREMOLO_STRINGS,
182 	B_PIZZICATO_STRINGS,
183 	B_ORCHESTRAL_STRINGS,
184 	B_TIMPANI,
185 
186 	/* Ensemble strings and voices */
187 	B_STRING_ENSEMBLE_1,
188 	B_STRING_ENSEMBLE_2,
189 	B_SYNTH_STRINGS_1,
190 	B_SYNTH_STRINGS_2,
191 	B_VOICE_AAH,
192 	B_VOICE_OOH,
193 	B_SYNTH_VOICE,
194 	B_ORCHESTRA_HIT,
195 
196 	/* Brass */
197 	B_TRUMPET,
198 	B_TROMBONE,
199 	B_TUBA,
200 	B_MUTED_TRUMPET,
201 	B_FRENCH_HORN,
202 	B_BRASS_SECTION,
203 	B_SYNTH_BRASS_1,
204 	B_SYNTH_BRASS_2,
205 
206 	/* Reeds */
207 	B_SOPRANO_SAX,
208 	B_ALTO_SAX,
209 	B_TENOR_SAX,
210 	B_BARITONE_SAX,
211 	B_OBOE,
212 	B_ENGLISH_HORN,
213 	B_BASSOON,
214 	B_CLARINET,
215 
216 	/* Pipes */
217 	B_PICCOLO,
218 	B_FLUTE,
219 	B_RECORDER,
220 	B_PAN_FLUTE,
221 	B_BLOWN_BOTTLE,
222 	B_SHAKUHACHI,
223 	B_WHISTLE,
224 	B_OCARINA,
225 
226 	/* Synth Leads*/
227 	B_LEAD_1,
228 	B_SQUARE_WAVE = B_LEAD_1,
229 	B_LEAD_2,
230 	B_SAWTOOTH_WAVE = B_LEAD_2,
231 	B_LEAD_3,
232 	B_CALLIOPE = B_LEAD_3,
233 	B_LEAD_4,
234 	B_CHIFF = B_LEAD_4,
235 	B_LEAD_5,
236 	B_CHARANG = B_LEAD_5,
237 	B_LEAD_6,
238 	B_VOICE = B_LEAD_6,
239 	B_LEAD_7,
240 	B_FIFTHS = B_LEAD_7,
241 	B_LEAD_8,
242 	B_BASS_LEAD = B_LEAD_8,
243 
244 	/* Synth Pads */
245 	B_PAD_1,
246 	B_NEW_AGE = B_PAD_1,
247 	B_PAD_2,
248 	B_WARM = B_PAD_2,
249 	B_PAD_3,
250 	B_POLYSYNTH = B_PAD_3,
251 	B_PAD_4,
252 	B_CHOIR = B_PAD_4,
253 	B_PAD_5,
254 	B_BOWED = B_PAD_5,
255 	B_PAD_6,
256 	B_METALLIC = B_PAD_6,
257 	B_PAD_7,
258 	B_HALO = B_PAD_7,
259 	B_PAD_8,
260 	B_SWEEP = B_PAD_8,
261 
262 	/* Effects */
263 	B_FX_1,
264 	B_FX_2,
265 	B_FX_3,
266 	B_FX_4,
267 	B_FX_5,
268 	B_FX_6,
269 	B_FX_7,
270 	B_FX_8,
271 
272 	/* Ethnic */
273 	B_SITAR,
274 	B_BANJO,
275 	B_SHAMISEN,
276 	B_KOTO,
277 	B_KALIMBA,
278 	B_BAGPIPE,
279 	B_FIDDLE,
280 	B_SHANAI,
281 
282 	/* Percussion */
283 	B_TINKLE_BELL,
284 	B_AGOGO,
285 	B_STEEL_DRUMS,
286 	B_WOODBLOCK,
287 	B_TAIKO_DRUMS,
288 	B_MELODIC_TOM,
289 	B_SYNTH_DRUM,
290 	B_REVERSE_CYMBAL,
291 
292 	/* Sound Effects */
293 	B_FRET_NOISE,
294 	B_BREATH_NOISE,
295 	B_SEASHORE,
296 	B_BIRD_TWEET,
297 	B_TELEPHONE,
298 	B_HELICOPTER,
299 	B_APPLAUSE,
300 	B_GUNSHOT
301 }
302 midi_axe;
303 
304 #endif // _MIDI_DEFS_H
305