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