]>
Commit | Line | Data |
---|---|---|
3a824aa5 | 1 | --- allegro/include/allegro/platform/alunix.h.orig Sun Dec 8 20:11:31 2002 |
2 | +++ allegro/include/allegro/platform/alunix.h Sun Jan 26 13:29:31 2003 | |
3 | @@ -157,6 +157,37 @@ | |
4 | ||
5 | #endif /* ALLEGRO_WITH_ALSAMIDI */ | |
6 | ||
7 | +#ifdef ALLEGRO_WITH_ALSA9DIGI | |
8 | + | |
9 | +#define DIGI_ALSA9 AL_ID('A','L','S','9') | |
10 | + | |
11 | +#ifndef ALLEGRO_WITH_MODULES | |
12 | + | |
13 | +AL_VAR(DIGI_DRIVER, digi_alsa9); | |
14 | + | |
15 | +#define DIGI_DRIVER_ALSA9 \ | |
16 | + { DIGI_ALSA9, &digi_alsa9, TRUE }, | |
17 | + | |
18 | +#endif | |
19 | + | |
20 | +#endif /* ALLEGRO_WITH_ALSA9DIGI */ | |
21 | + | |
22 | + | |
23 | +#ifdef ALLEGRO_WITH_ALSA9MIDI | |
24 | + | |
25 | +#define MIDI_ALSA9 AL_ID('A','M','I','9') | |
26 | + | |
27 | +#ifndef ALLEGRO_WITH_MODULES | |
28 | + | |
29 | +AL_VAR(MIDI_DRIVER, midi_alsa9); | |
30 | + | |
31 | +#define MIDI_DRIVER_ALSA9 \ | |
32 | + { MIDI_ALSA9, &midi_alsa9, TRUE }, | |
33 | + | |
34 | +#endif | |
35 | + | |
36 | +#endif /* ALLEGRO_WITH_ALSA9MIDI */ | |
37 | + | |
38 | ||
39 | ||
40 | /************************************/ | |
41 | diff -uNr allegro-4.1.6.old/acconfig.h allegro-4.1.6/acconfig.h | |
42 | --- allegro-4.1.6.old/acconfig.h Sat Nov 30 12:13:21 2002 | |
43 | +++ allegro-4.1.6/acconfig.h Fri Dec 6 17:40:10 2002 | |
44 | @@ -79,6 +79,12 @@ | |
45 | /* Define if ALSA MIDI driver is supported. */ | |
46 | #undef ALLEGRO_WITH_ALSAMIDI | |
47 | ||
48 | +/* Define if ALSA9 DIGI driver is supported. */ | |
49 | +#undef ALLEGRO_WITH_ALSA9DIGI | |
50 | + | |
51 | +/* Define if ALSA9 MIDI driver is supported. */ | |
52 | +#undef ALLEGRO_WITH_ALSA9MIDI | |
53 | + | |
54 | /* Define if ESD DIGI driver is supported. */ | |
55 | #undef ALLEGRO_WITH_ESDDIGI | |
56 | ||
57 | diff -uNr allegro-4.1.6.old/aclocal.m4 allegro-4.1.6/aclocal.m4 | |
58 | --- allegro-4.1.6.old/aclocal.m4 Sat Nov 30 12:13:21 2002 | |
59 | +++ allegro-4.1.6/aclocal.m4 Fri Dec 6 17:40:10 2002 | |
60 | @@ -363,6 +363,60 @@ | |
61 | fi]) | |
62 | ||
63 | dnl | |
64 | +dnl Test for ALSA9 DIGI driver. | |
65 | +dnl | |
66 | +dnl Variables: | |
67 | +dnl allegro_enable_alsa9digi=(yes|) | |
68 | +dnl allegro_cv_support_alsa9digi=(yes|) | |
69 | +dnl | |
70 | +AC_DEFUN(ALLEGRO_ACTEST_ALSA9DIGI, | |
71 | +[AC_ARG_ENABLE(alsa9digi, | |
72 | +[ --enable-alsa9digi[=x] enable building ALSA9 DIGI driver [default=yes]], | |
73 | +test "X$enableval" != "Xno" && allegro_enable_alsa9digi=yes, | |
74 | +allegro_enable_alsa9digi=yes) | |
75 | + | |
76 | +if test -n "$allegro_enable_alsa9digi"; then | |
77 | + AC_CACHE_CHECK(for supported ALSA9 version for digital sound, | |
78 | + allegro_cv_support_alsa9digi, | |
79 | + AC_TRY_RUN([#include <alsa/asoundlib.h> | |
80 | + int main (void) { return SND_LIB_MAJOR != 0 || SND_LIB_MINOR != 9; }], | |
81 | + allegro_cv_support_alsa9digi=yes, | |
82 | + allegro_cv_support_alsa9digi=no, | |
83 | + allegro_cv_support_alsa9digi=no)) | |
84 | + if test "X$allegro_cv_support_alsa9digi" = "Xyes" && | |
85 | + test -z "$allegro_support_modules"; then | |
86 | + LIBS="-lasound $LIBS" | |
87 | + fi | |
88 | +fi]) | |
89 | + | |
90 | +dnl | |
91 | +dnl Test for ALSA9 MIDI driver. | |
92 | +dnl | |
93 | +dnl Variables: | |
94 | +dnl allegro_enable_alsa9midi=(yes|) | |
95 | +dnl allegro_support_alsa9midi=(yes|) | |
96 | +dnl | |
97 | +AC_DEFUN(ALLEGRO_ACTEST_ALSA9MIDI, | |
98 | +[AC_ARG_ENABLE(alsa9midi, | |
99 | +[ --enable-alsa9midi[=x] enable building ALSA9 MIDI driver [default=yes]], | |
100 | +test "X$enableval" != "Xno" && allegro_enable_alsa9midi=yes, | |
101 | +allegro_enable_alsa9midi=yes) | |
102 | + | |
103 | +if test -n "$allegro_enable_alsa9midi"; then | |
104 | + AC_CACHE_CHECK(for supported ALSA9 version for MIDI, | |
105 | + allegro_cv_support_alsa9midi, | |
106 | + AC_TRY_RUN([#include <alsa/asoundlib.h> | |
107 | + int main (void) { return SND_LIB_MAJOR != 0 || SND_LIB_MINOR != 9; }], | |
108 | + allegro_cv_support_alsa9midi=yes, | |
109 | + allegro_cv_support_alsa9midi=no, | |
110 | + allegro_cv_support_alsa9midi=no)) | |
111 | + if test "X$allegro_cv_support_alsa9midi" = "Xyes" && | |
112 | + test -z "$allegro_support_modules"; then | |
113 | + LIBS="-lasound $LIBS" | |
114 | + fi | |
115 | +fi]) | |
116 | + | |
117 | +dnl | |
118 | dnl Test for ESD DIGI driver. | |
119 | dnl | |
120 | dnl Variables: | |
121 | diff -uNr allegro-4.1.6.old/allegro.mft allegro-4.1.6/allegro.mft | |
122 | --- allegro-4.1.6.old/allegro.mft Sat Nov 30 12:18:28 2002 | |
123 | +++ allegro-4.1.6/allegro.mft Fri Dec 6 17:40:10 2002 | |
124 | @@ -685,6 +685,8 @@ | |
125 | allegro/src/unix/ | |
126 | allegro/src/unix/alsa.c | |
127 | allegro/src/unix/alsamidi.c | |
128 | +allegro/src/unix/alsa9.c | |
129 | +allegro/src/unix/alsa9midi.c | |
130 | allegro/src/unix/arts.c | |
131 | allegro/src/unix/sgial.c | |
132 | allegro/src/unix/udjgpp.c | |
133 | diff -uNr allegro-4.1.6.old/configure.in allegro-4.1.6/configure.in | |
134 | --- allegro-4.1.6.old/configure.in Sat Nov 30 12:13:21 2002 | |
135 | +++ allegro-4.1.6/configure.in Fri Dec 6 17:40:10 2002 | |
136 | @@ -304,6 +304,17 @@ | |
137 | AC_DEFINE(ALLEGRO_WITH_ALSAMIDI) | |
138 | fi | |
139 | ||
140 | +dnl Test for ALSA9 drivers. | |
141 | +ALLEGRO_ACTEST_ALSA9DIGI | |
142 | +if test "$allegro_cv_support_alsa9digi" = yes; then | |
143 | + AC_DEFINE(ALLEGRO_WITH_ALSA9DIGI) | |
144 | +fi | |
145 | + | |
146 | +ALLEGRO_ACTEST_ALSA9MIDI | |
147 | +if test "$allegro_cv_support_alsa9midi" = yes; then | |
148 | + AC_DEFINE(ALLEGRO_WITH_ALSA9MIDI) | |
149 | +fi | |
150 | + | |
151 | dnl Test for ESD drivers. | |
152 | ALLEGRO_ACTEST_ESDDIGI | |
153 | if test -n "$allegro_support_esddigi"; then | |
154 | @@ -478,6 +489,16 @@ | |
155 | ALLEGRO_MODULE_TARGETS="$ALLEGRO_MODULE_TARGETS lib/unix/alleg-alsamidi.so" | |
156 | fi | |
157 | ||
158 | + dnl ALSA9 DIGI. | |
159 | + if test "X$allegro_cv_support_alsa9digi" = "Xyes"; then | |
160 | + ALLEGRO_MODULE_TARGETS="$ALLEGRO_MODULE_TARGETS lib/unix/alleg-alsa9digi.so" | |
161 | + fi | |
162 | + | |
163 | + dnl ALSA9 MIDI. | |
164 | + if test "X$allegro_cv_support_alsa9midi" = "Xyes"; then | |
165 | + ALLEGRO_MODULE_TARGETS="$ALLEGRO_MODULE_TARGETS lib/unix/alleg-alsa9midi.so" | |
166 | + fi | |
167 | + | |
168 | dnl ESD DIGI. | |
169 | if test "X$allegro_support_esddigi" = "Xyes"; then | |
170 | ALLEGRO_MODULE_TARGETS="$ALLEGRO_MODULE_TARGETS lib/unix/alleg-esddigi.so" | |
171 | diff -uNr allegro-4.1.6.old/makefile.in allegro-4.1.6/makefile.in | |
172 | --- allegro-4.1.6.old/makefile.in Fri Dec 6 17:39:38 2002 | |
173 | +++ allegro-4.1.6/makefile.in Fri Dec 6 17:40:10 2002 | |
174 | @@ -526,6 +526,8 @@ | |
175 | $(SHELL) -c 'cd $(srcdir) && misc/depmod.sh dga2 -lXxf86dga $(ALLEGRO_MODULE_DGA2_FILES)' >> makefile.dep | |
176 | $(SHELL) -c 'cd $(srcdir) && misc/depmod.sh alsadigi -lasound $(ALLEGRO_MODULE_ALSADIGI_FILES)' >>makefile.dep | |
177 | $(SHELL) -c 'cd $(srcdir) && misc/depmod.sh alsamidi -lasound $(ALLEGRO_MODULE_ALSAMIDI_FILES)' >>makefile.dep | |
178 | + $(SHELL) -c 'cd $(srcdir) && misc/depmod.sh alsa9digi -lasound $(ALLEGRO_MODULE_ALSA9DIGI_FILES)' >>makefile.dep | |
179 | + $(SHELL) -c 'cd $(srcdir) && misc/depmod.sh alsa9midi -lasound $(ALLEGRO_MODULE_ALSA9MIDI_FILES)' >>makefile.dep | |
180 | $(SHELL) -c 'cd $(srcdir) && misc/depmod.sh esddigi "\`esd-config --libs\`" $(ALLEGRO_MODULE_ESD_FILES)' >>makefile.dep | |
181 | $(SHELL) -c 'cd $(srcdir) && misc/depmod.sh artsdigi "\`artsc-config --libs\`" $(ALLEGRO_MODULE_ARTS_FILES)' >>makefile.dep | |
182 | $(SHELL) -c 'cd $(srcdir) && misc/depmod.sh sgialdigi -laudio $(ALLEGRO_MODULE_SGIAL_FILES)' >>makefile.dep | |
183 | diff -uNr allegro-4.1.6.old/makefile.lst allegro-4.1.6/makefile.lst | |
184 | --- allegro-4.1.6.old/makefile.lst Sat Nov 30 12:13:21 2002 | |
185 | +++ allegro-4.1.6/makefile.lst Fri Dec 6 17:40:10 2002 | |
186 | @@ -268,6 +268,8 @@ | |
187 | ALLEGRO_SRC_UNIX_FILES = \ | |
188 | src/unix/alsa.c \ | |
189 | src/unix/alsamidi.c \ | |
190 | + src/unix/alsa9.c \ | |
191 | + src/unix/alsa9midi.c \ | |
192 | src/unix/arts.c \ | |
193 | src/unix/sgial.c \ | |
194 | src/unix/udjgpp.c \ | |
195 | @@ -350,6 +352,12 @@ | |
196 | ALLEGRO_MODULE_ALSAMIDI_FILES = \ | |
197 | src/unix/alsamidi.c | |
198 | ||
199 | +ALLEGRO_MODULE_ALSA9DIGI_FILES = \ | |
200 | + src/unix/alsa9.c | |
201 | + | |
202 | +ALLEGRO_MODULE_ALSA9MIDI_FILES = \ | |
203 | + src/unix/alsa9midi.c | |
204 | + | |
205 | ALLEGRO_MODULE_ESD_FILES = \ | |
206 | src/unix/uesd.c | |
207 | ||
208 | diff -uNr allegro-4.1.6.old/modules.lst allegro-4.1.6/modules.lst | |
209 | --- allegro-4.1.6.old/modules.lst Sat Nov 30 12:13:21 2002 | |
210 | +++ allegro-4.1.6/modules.lst Fri Dec 6 17:40:10 2002 | |
211 | @@ -9,3 +9,5 @@ | |
212 | alleg-sgialdigi.so | |
213 | alleg-alsadigi.so | |
214 | alleg-alsamidi.so | |
215 | +alleg-alsa9digi.so | |
216 | +alleg-alsa9midi.so | |
217 | diff -uNr allegro-4.1.6.old/setup/setup.c allegro-4.1.6/setup/setup.c | |
218 | --- allegro-4.1.6.old/setup/setup.c Sat Nov 30 12:13:22 2002 | |
219 | +++ allegro-4.1.6/setup/setup.c Fri Dec 6 17:42:22 2002 | |
220 | @@ -234,6 +234,17 @@ | |
221 | { "alsa_rawmidi_card", param_int, "", "", NULL, "Card:", NULL, NULL, "ALSA RawMIDI card number" }, | |
222 | { "alsa_rawmidi_device",param_int, "", "", NULL, "Dev:", NULL, NULL, "ALSA RawMIDI device number" }, | |
223 | #endif | |
224 | + | |
225 | + #ifdef DIGI_ALSA9 | |
226 | + { "alsa_card", param_int, "", "", NULL, "Card:", NULL, NULL, "ALSA card number" }, | |
227 | + { "alsa_pcmdevice", param_int, "", "", NULL, "Dev:", NULL, NULL, "ALSA PCM device number" }, | |
228 | + { "alsa_numfrags", param_int, "", "", NULL, "NumFr:", NULL, NULL, "Number of fragments (use 2, other values make little difference)" }, | |
229 | + #endif | |
230 | + | |
231 | + #ifdef MIDI_ALSA9 | |
232 | + { "alsa_rawmidi_card", param_int, "", "", NULL, "Card:", NULL, NULL, "ALSA RawMIDI card number" }, | |
233 | + { "alsa_rawmidi_device",param_int, "", "", NULL, "Dev:", NULL, NULL, "ALSA RawMIDI device number" }, | |
234 | + #endif | |
235 | ||
236 | #ifdef MIDI_BEOS | |
237 | { "be_midi_quality", param_int, "", "1", NULL, "Qual:", NULL, NULL, "BeOS MIDI synthetizer instruments quality (0 = low, 1 = high)" }, | |
238 | @@ -432,6 +443,16 @@ | |
239 | } | |
240 | #endif | |
241 | ||
242 | + #ifdef DIGI_ALSA9 | |
243 | + case DIGI_ALSA9: | |
244 | + { | |
245 | + static char *param[] = {"flip_pan", "sound_bits", "sound_stereo", "alsa_numfrags", "alsa_card", "alsa_pcmdevice", "sound_freq", "digi_volume", NULL}; | |
246 | + digi_cards[c].param = uconvert_static_string_array(param); | |
247 | + digi_cards[c].desc = uconvert_static_string("ALSA Sound System"); | |
248 | + break; | |
249 | + } | |
250 | + #endif | |
251 | + | |
252 | #ifdef DIGI_BEOS | |
253 | case DIGI_BEOS: | |
254 | { | |
255 | @@ -550,6 +571,16 @@ | |
256 | { | |
257 | static char *param[] = {"22", "alsa_rawmidi_card", "alsa_rawmidi_device", "", "midi_volume", NULL}; | |
258 | midi_cards[c].param = uconvert_static_string_array(param); | |
259 | + midi_cards[c].desc = uconvert_static_string("ALSA RawMIDI"); | |
260 | + break; | |
261 | + } | |
262 | + #endif | |
263 | + | |
264 | + #ifdef MIDI_ALSA9 | |
265 | + case MIDI_ALSA9: | |
266 | + { | |
267 | + static char *param[] = {"22", "alsa_rawmidi_card", "alsa_rawmidi_device", "", "midi_volume", NULL}; | |
268 | + midi_cards[c].param = uconvert_static_string_array(param); | |
269 | midi_cards[c].desc = uconvert_static_string("ALSA RawMIDI"); | |
270 | break; | |
271 | } | |
272 | diff -uNr allegro-4.1.6.old/src/unix/alsa9.c allegro-4.1.6/src/unix/alsa9.c | |
273 | --- allegro-4.1.6.old/src/unix/alsa9.c Thu Jan 1 01:00:00 1970 | |
274 | +++ allegro-4.1.6/src/unix/alsa9.c Mon Oct 28 21:20:48 2002 | |
275 | @@ -0,0 +1,428 @@ | |
276 | +/* ______ ___ ___ | |
277 | + * /\ _ \ /\_ \ /\_ \ | |
278 | + * \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___ | |
279 | + * \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\ | |
280 | + * \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \ | |
281 | + * \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/ | |
282 | + * \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/ | |
283 | + * /\____/ | |
284 | + * \_/__/ | |
285 | + * | |
286 | + * ALSA 0.9 sound driver. | |
287 | + * | |
288 | + * By Grzegorz Godlewski based on Alsa 0.5, OSS and MPlayer 0.9 | |
289 | + * | |
290 | + * See readme.txt for copyright information. | |
291 | + */ | |
292 | + | |
293 | + | |
294 | +#include "allegro.h" | |
295 | + | |
296 | +#if (defined DIGI_ALSA9) && ((!defined ALLEGRO_WITH_MODULES) || (defined ALLEGRO_MODULE)) | |
297 | + | |
298 | +#include "allegro/internal/aintern.h" | |
299 | +#ifdef ALLEGRO_QNX | |
300 | +#include "allegro/platform/aintqnx.h" | |
301 | +#else | |
302 | +#include "allegro/platform/aintunix.h" | |
303 | +#endif | |
304 | + | |
305 | +#ifndef SCAN_DEPEND | |
306 | + #include <string.h> | |
307 | + #include <alsa/asoundlib.h> | |
308 | +#endif | |
309 | + | |
310 | +#ifndef SND_PCM_FORMAT_S16_NE | |
311 | + #ifdef ALLEGRO_BIG_ENDIAN | |
312 | + #define SND_PCM_FORMAT_S16_NE SND_PCM_FORMAT_S16_BE | |
313 | + #else | |
314 | + #define SND_PCM_FORMAT_S16_NE SND_PCM_FORMAT_S16_LE | |
315 | + #endif | |
316 | +#endif | |
317 | +#ifndef SND_PCM_FORMAT_U16_NE | |
318 | + #ifdef ALLEGRO_BIG_ENDIAN | |
319 | + #define SND_PCM_FORMAT_U16_NE SND_PCM_FORMAT_U16_BE | |
320 | + #else | |
321 | + #define SND_PCM_FORMAT_U16_NE SND_PCM_FORMAT_U16_LE | |
322 | + #endif | |
323 | +#endif | |
324 | + | |
325 | + | |
326 | +#define ALSA9_DEFAULT_NUMFRAGS 2 | |
327 | +#define ALSA9_DEFAULT_FRAGSIZE 8192 | |
328 | + | |
329 | +static snd_pcm_t *pcm_handle=NULL; | |
330 | +static int alsa9_bufsize; | |
331 | +static unsigned char *alsa9_bufdata; | |
332 | +static int alsa9_bits, alsa9_signed, alsa9_rate, alsa9_stereo; | |
333 | +static int periods,periodsize; | |
334 | + | |
335 | +static char alsa9_desc[256] = EMPTY_STRING; | |
336 | + | |
337 | + | |
338 | + | |
339 | +static int alsa9_detect(int input); | |
340 | +static int alsa9_init(int input, int voices); | |
341 | +static void alsa9_exit(int input); | |
342 | +static int alsa9_mixer_volume(int volume); | |
343 | +static int alsa9_buffer_size(void); | |
344 | + | |
345 | + | |
346 | + | |
347 | +DIGI_DRIVER digi_alsa9 = | |
348 | +{ | |
349 | + DIGI_ALSA9, | |
350 | + empty_string, | |
351 | + empty_string, | |
352 | + "ALSA9", | |
353 | + 0, | |
354 | + 0, | |
355 | + MIXER_MAX_SFX, | |
356 | + MIXER_DEF_SFX, | |
357 | + | |
358 | + alsa9_detect, | |
359 | + alsa9_init, | |
360 | + alsa9_exit, | |
361 | + alsa9_mixer_volume, | |
362 | + | |
363 | + NULL, | |
364 | + NULL, | |
365 | + alsa9_buffer_size, | |
366 | + _mixer_init_voice, | |
367 | + _mixer_release_voice, | |
368 | + _mixer_start_voice, | |
369 | + _mixer_stop_voice, | |
370 | + _mixer_loop_voice, | |
371 | + | |
372 | + _mixer_get_position, | |
373 | + _mixer_set_position, | |
374 | + | |
375 | + _mixer_get_volume, | |
376 | + _mixer_set_volume, | |
377 | + _mixer_ramp_volume, | |
378 | + _mixer_stop_volume_ramp, | |
379 | + | |
380 | + _mixer_get_frequency, | |
381 | + _mixer_set_frequency, | |
382 | + _mixer_sweep_frequency, | |
383 | + _mixer_stop_frequency_sweep, | |
384 | + | |
385 | + _mixer_get_pan, | |
386 | + _mixer_set_pan, | |
387 | + _mixer_sweep_pan, | |
388 | + _mixer_stop_pan_sweep, | |
389 | + | |
390 | + _mixer_set_echo, | |
391 | + _mixer_set_tremolo, | |
392 | + _mixer_set_vibrato, | |
393 | + 0, 0, | |
394 | + 0, | |
395 | + 0, | |
396 | + 0, | |
397 | + 0, | |
398 | + 0, | |
399 | + 0 | |
400 | +}; | |
401 | + | |
402 | + | |
403 | + | |
404 | +/* alsa9_buffer_size: | |
405 | + * Returns the current DMA buffer size, for use by the audiostream code. | |
406 | + */ | |
407 | +static int alsa9_buffer_size() | |
408 | +{ | |
409 | + return alsa9_bufsize; | |
410 | +} | |
411 | + | |
412 | +/* alsa9_update: | |
413 | + * Update data. | |
414 | + */ | |
415 | +static void alsa9_update(int threaded) | |
416 | +{ | |
417 | + int frames; | |
418 | + | |
419 | + if (!pcm_handle) { | |
420 | + printf("alsa-play: device configuration error"); | |
421 | + return; | |
422 | + } | |
423 | + | |
424 | + frames = periodsize >> ((alsa9_stereo)?3:2); | |
425 | + while (snd_pcm_writei(pcm_handle, alsa9_bufdata, frames) <0) | |
426 | + { | |
427 | + snd_pcm_prepare(pcm_handle); | |
428 | + } | |
429 | + _mix_some_samples((unsigned long) alsa9_bufdata, 0, alsa9_signed); | |
430 | +} | |
431 | + | |
432 | + | |
433 | + | |
434 | +/* alsa9_detect: | |
435 | + * Detect driver presence. | |
436 | + */ | |
437 | +static int alsa9_detect(int input) | |
438 | +{ | |
439 | + snd_pcm_t *handle; | |
440 | + int card, device; | |
441 | + char tmp1[128], tmp2[128]; | |
442 | + int ret = FALSE; | |
443 | + snd_pcm_hw_params_t *hwparams; | |
444 | + char pcm_name[128]; | |
445 | + | |
446 | + card = get_config_int(uconvert_ascii("sound", tmp1), | |
447 | + uconvert_ascii("alsa_card", tmp2), | |
448 | + 0); | |
449 | + | |
450 | + device = get_config_int(uconvert_ascii("sound", tmp1), | |
451 | + uconvert_ascii("alsa_pcmdevice", tmp2), | |
452 | + 0); | |
453 | + | |
454 | + | |
455 | + sprintf(pcm_name,"plughw:%d,%d",card,device); | |
456 | + snd_pcm_hw_params_alloca(&hwparams); | |
457 | + | |
458 | + if (!(snd_pcm_open(&handle, pcm_name, SND_PCM_STREAM_PLAYBACK , 0) < 0)) { | |
459 | + if (!(snd_pcm_hw_params_any(handle, hwparams) < 0)) { | |
460 | + ret = TRUE; | |
461 | + } | |
462 | + snd_pcm_close(handle); | |
463 | + } | |
464 | + | |
465 | + return ret; | |
466 | +} | |
467 | + | |
468 | + | |
469 | + | |
470 | +/* alsa9_init: | |
471 | + * ALSA9 init routine. | |
472 | + */ | |
473 | +static int alsa9_init(int input, int voices) | |
474 | +{ | |
475 | + int card, device; | |
476 | + int format, bps; //, fragsize, numfrags; | |
477 | + char tmp1[128], tmp2[128]; | |
478 | + int exact_rate; | |
479 | + int dir; | |
480 | + | |
481 | + snd_pcm_hw_params_t *hwparams; | |
482 | + char pcm_name[128]; | |
483 | + | |
484 | + if (input) { | |
485 | + ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE, get_config_text("Input is not supported")); | |
486 | + return -1; | |
487 | + } | |
488 | + | |
489 | + /* Load config. */ | |
490 | + card = get_config_int(uconvert_ascii("sound", tmp1), | |
491 | + uconvert_ascii("alsadigi_card", tmp2), | |
492 | + 0); //snd_defaults_card()); | |
493 | + | |
494 | + device = get_config_int(uconvert_ascii("sound", tmp1), | |
495 | + uconvert_ascii("alsadigi_pcmdevice", tmp2), | |
496 | + 0); //snd_defaults_pcm_device()); | |
497 | + | |
498 | + periodsize = get_config_int(uconvert_ascii("sound", tmp1), | |
499 | + uconvert_ascii("alsa_fragsize", tmp2), | |
500 | + ALSA9_DEFAULT_FRAGSIZE); | |
501 | + | |
502 | + periods = get_config_int(uconvert_ascii("sound", tmp1), | |
503 | + uconvert_ascii("alsa_numfrags", tmp2), | |
504 | + ALSA9_DEFAULT_NUMFRAGS); | |
505 | + | |
506 | + sprintf(pcm_name,"plughw:%d,%d",card,device); | |
507 | + snd_pcm_hw_params_alloca(&hwparams); | |
508 | + | |
509 | + /* Open PCM device. */ | |
510 | + if (snd_pcm_open(&pcm_handle, pcm_name, (SND_PCM_STREAM_PLAYBACK), 0) < 0) { | |
511 | + ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE, get_config_text("Can not open card/pcm device")); | |
512 | + goto error; | |
513 | + } | |
514 | + | |
515 | + /* Init hwparams with full configuration space */ | |
516 | + if (snd_pcm_hw_params_any(pcm_handle, hwparams) < 0) { | |
517 | + ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE, get_config_text("Can not configure this PCM device")); | |
518 | + goto error; | |
519 | + } | |
520 | + | |
521 | + if (snd_pcm_hw_params_set_access(pcm_handle, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED) < 0) { | |
522 | + ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE, get_config_text("Error setting access")); | |
523 | + goto error; | |
524 | + } | |
525 | + | |
526 | + /* Set format variables. */ | |
527 | + alsa9_bits = (_sound_bits == 8) ? 8 : 16; | |
528 | + alsa9_stereo = (_sound_stereo) ? 1 : 0; | |
529 | + alsa9_rate = (_sound_freq > 0) ? _sound_freq : 44100; | |
530 | + | |
531 | + format = ((alsa9_bits == 16) ? SND_PCM_FORMAT_S16_NE : SND_PCM_FORMAT_S8); | |
532 | + | |
533 | + alsa9_signed = 0; | |
534 | + bps = alsa9_rate * (alsa9_stereo ? 2 : 1); | |
535 | + switch (format) { | |
536 | + case SND_PCM_FORMAT_S8: | |
537 | + alsa9_signed = 1; | |
538 | + case SND_PCM_FORMAT_U8: | |
539 | + alsa9_bits = 8; | |
540 | + break; | |
541 | + case SND_PCM_FORMAT_S16_NE: | |
542 | + alsa9_signed = 1; | |
543 | + case SND_PCM_FORMAT_U16_NE: | |
544 | + alsa9_bits = 16; | |
545 | + bps <<= 1; | |
546 | + if (sizeof(short) != 2) { | |
547 | + ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE, get_config_text("Unsupported sample format")); | |
548 | + goto error; | |
549 | + } | |
550 | + break; | |
551 | + default: | |
552 | + ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE, get_config_text("Unsupported sample format")); | |
553 | + goto error; | |
554 | + } | |
555 | + | |
556 | + /* Set sample format */ | |
557 | + if (snd_pcm_hw_params_set_format(pcm_handle, hwparams, format) < 0) { | |
558 | + ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE, get_config_text("Error setting format")); | |
559 | + goto error; | |
560 | + } | |
561 | + | |
562 | + | |
563 | + /* Set sample rate. If the exact rate is not supported */ | |
564 | + /* by the hardware, use nearest possible rate. */ | |
565 | + exact_rate=snd_pcm_hw_params_set_rate_near(pcm_handle, hwparams, alsa9_rate, &dir); | |
566 | + if (dir!=0) | |
567 | + { | |
568 | + //fprintf(stderr, "The rate %d Hz is not supported by your hardware.\n | |
569 | + // ==> Using %d Hz instead.\n", rate, exact_rate); | |
570 | +// ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE, get_config_text("The rate is not supported by your hardware")); | |
571 | +// goto error; | |
572 | + } | |
573 | + | |
574 | + /* Set number of channels */ | |
575 | + if (snd_pcm_hw_params_set_channels(pcm_handle, hwparams, (alsa9_stereo) ? 2:1) < 0) { | |
576 | + ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE, get_config_text("Error setting channels")); | |
577 | + goto error; | |
578 | + } | |
579 | + | |
580 | + /* Set number of numfrags. numfrags used to be called fragments. */ | |
581 | + if (snd_pcm_hw_params_set_periods(pcm_handle, hwparams, periods, 0) < 0) { | |
582 | + ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE, get_config_text("Error setting numfrags")); | |
583 | + goto error; | |
584 | + } | |
585 | + | |
586 | + alsa9_bufsize=(periodsize * periods)>>2; | |
587 | + /* Set buffer size (in frames). The resulting latency is given by */ | |
588 | + /* latency = fragsize * numfrags / (rate * bytes_per_frame) */ | |
589 | + if (snd_pcm_hw_params_set_buffer_size(pcm_handle, hwparams, alsa9_bufsize) < 0) { | |
590 | + ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE, get_config_text("Error setting buffersize")); | |
591 | + goto error; | |
592 | + } | |
593 | + | |
594 | + /* Apply HW parameter settings to */ | |
595 | + /* PCM device and prepare device */ | |
596 | + if (snd_pcm_hw_params(pcm_handle, hwparams) < 0) { | |
597 | + ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE, get_config_text("Error setting HW params")); | |
598 | + goto error; | |
599 | + } | |
600 | + | |
601 | + alsa9_bufdata = malloc(alsa9_bufsize); | |
602 | + | |
603 | + if (!alsa9_bufdata) { | |
604 | + ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE, get_config_text("Can not allocate audio buffer")); | |
605 | + goto error; | |
606 | + } | |
607 | + | |
608 | + /* Initialise mixer. */ | |
609 | + digi_alsa9.voices = voices; | |
610 | + | |
611 | + if (_mixer_init(alsa9_bufsize / (alsa9_bits / 8), alsa9_rate, | |
612 | + alsa9_stereo, ((alsa9_bits == 16) ? 1 : 0), | |
613 | + &digi_alsa9.voices) != 0) { | |
614 | + ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE, get_config_text("Can not init software mixer")); | |
615 | + goto error; | |
616 | + } | |
617 | + | |
618 | + _mix_some_samples((unsigned long) alsa9_bufdata, 0, alsa9_signed); | |
619 | + | |
620 | + /* Add audio interrupt. */ | |
621 | + _unix_bg_man->register_func(alsa9_update); | |
622 | + | |
623 | + uszprintf(alsa9_desc, sizeof(alsa9_desc), | |
624 | + get_config_text("Card #%d, device #%d: %d bits, %s, %d bps, %s"), | |
625 | + card, device, alsa9_bits, | |
626 | + uconvert_ascii((alsa9_signed ? "signed" : "unsigned"), tmp1), | |
627 | + alsa9_rate, | |
628 | + uconvert_ascii((alsa9_stereo ? "stereo" : "mono"), tmp2)); | |
629 | + | |
630 | + digi_driver->desc = alsa9_desc; | |
631 | + return 0; | |
632 | + | |
633 | + error: | |
634 | + | |
635 | + if (pcm_handle) { | |
636 | + snd_pcm_close(pcm_handle); | |
637 | + pcm_handle = NULL; | |
638 | + } | |
639 | + | |
640 | + return -1; | |
641 | +} | |
642 | + | |
643 | + | |
644 | + | |
645 | +/* alsa9_exit: | |
646 | + * Shutdown ALSA9 driver. | |
647 | + */ | |
648 | +static void alsa9_exit(int input) | |
649 | +{ | |
650 | + if (input) { | |
651 | + return; | |
652 | + } | |
653 | + | |
654 | + _unix_bg_man->unregister_func(alsa9_update); | |
655 | + | |
656 | + free(alsa9_bufdata); | |
657 | + alsa9_bufdata = NULL; | |
658 | + | |
659 | + _mixer_exit(); | |
660 | + | |
661 | + snd_pcm_close(pcm_handle); | |
662 | +} | |
663 | + | |
664 | + | |
665 | + | |
666 | +/* alsa9_mixer_volume: | |
667 | + * Set mixer volume (0-255) | |
668 | + */ | |
669 | +static int alsa9_mixer_volume(int volume) | |
670 | +{ | |
671 | + /* TODO */ | |
672 | +#if 0 | |
673 | + snd_mixer_t *handle; | |
674 | + int card, device; | |
675 | + | |
676 | + if (snd_mixer_open(&handle, card, device) == 0) { | |
677 | + /* do something special */ | |
678 | + snd_mixer_close(handle); | |
679 | + return 0; | |
680 | + } | |
681 | + | |
682 | + return -1; | |
683 | +#else | |
684 | + return 0; | |
685 | +#endif | |
686 | +} | |
687 | + | |
688 | + | |
689 | + | |
690 | +#ifdef ALLEGRO_MODULE | |
691 | + | |
692 | +/* _module_init: | |
693 | + * Called when loaded as a dynamically linked module. | |
694 | + */ | |
695 | +void _module_init(int system_driver) | |
696 | +{ | |
697 | + _unix_register_digi_driver(DIGI_ALSA9, &digi_alsa9, TRUE, TRUE); | |
698 | +} | |
699 | + | |
700 | +#endif | |
701 | + | |
702 | +#endif | |
703 | + | |
704 | diff -uNr allegro-4.1.6.old/src/unix/alsa9midi.c allegro-4.1.6/src/unix/alsa9midi.c | |
705 | --- allegro-4.1.6.old/src/unix/alsa9midi.c Thu Jan 1 01:00:00 1970 | |
706 | +++ allegro-4.1.6/src/unix/alsa9midi.c Mon Oct 28 20:51:06 2002 | |
707 | @@ -0,0 +1,251 @@ | |
708 | +/* ______ ___ ___ | |
709 | + * /\ _ \ /\_ \ /\_ \ | |
710 | + * \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___ | |
711 | + * \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\ | |
712 | + * \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \ | |
713 | + * \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/ | |
714 | + * \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/ | |
715 | + * /\____/ | |
716 | + * \_/__/ | |
717 | + * | |
718 | + * ALSA 0.9 RawMIDI Sound driver. | |
719 | + * | |
720 | + * By Grzegorz Godlewski based on 0.5 version | |
721 | + * | |
722 | + * See readme.txt for copyright information. | |
723 | + */ | |
724 | + | |
725 | +#include "allegro.h" | |
726 | + | |
727 | +#if (defined MIDI_ALSA9) && ((!defined ALLEGRO_WITH_MODULES) || (defined ALLEGRO_MODULE)) | |
728 | + | |
729 | +#include "allegro/internal/aintern.h" | |
730 | +#ifdef ALLEGRO_QNX | |
731 | +#include "allegro/platform/aintqnx.h" | |
732 | +#else | |
733 | +#include "allegro/platform/aintunix.h" | |
734 | +#endif | |
735 | + | |
736 | +#ifndef SCAN_DEPEND | |
737 | + #include <stdlib.h> | |
738 | + #include <stdio.h> | |
739 | + #include <string.h> | |
740 | + #include <errno.h> | |
741 | + #include <sys/asoundlib.h> | |
742 | +#endif | |
743 | + | |
744 | +/* external interface to the ALSA9 rawmidi driver */ | |
745 | +static int alsa9_rawmidi_detect(int input); | |
746 | +static int alsa9_rawmidi_init(int input, int voices); | |
747 | +static void alsa9_rawmidi_exit(int input); | |
748 | +static void alsa9_rawmidi_output(int data); | |
749 | + | |
750 | +static char alsa9_rawmidi_desc[256]; | |
751 | + | |
752 | +static snd_rawmidi_t *rawmidi_handle = NULL; | |
753 | + | |
754 | +MIDI_DRIVER midi_alsa9 = | |
755 | +{ | |
756 | + MIDI_ALSA9, /* id */ | |
757 | + empty_string, /* name */ | |
758 | + empty_string, /* desc */ | |
759 | + "ALSA9 RawMIDI", /* ASCII name */ | |
760 | + 0, 0, 0xFFFF, 0, -1, -1, /* voices, basevoice, max_voices, def_voices, xmin, xmax */ | |
761 | + alsa9_rawmidi_detect, /* detect */ | |
762 | + alsa9_rawmidi_init, /* init */ | |
763 | + alsa9_rawmidi_exit, /* exit */ | |
764 | + NULL, /* mixer_volume */ | |
765 | + alsa9_rawmidi_output, /* raw_midi */ | |
766 | + _dummy_load_patches, /* load_patches */ | |
767 | + _dummy_adjust_patches, /* adjust_patches */ | |
768 | + _dummy_key_on, /* key_on */ | |
769 | + _dummy_noop1, /* key_off */ | |
770 | + _dummy_noop2, /* set_volume */ | |
771 | + _dummy_noop3, /* set_pitch */ | |
772 | + _dummy_noop2, /* set_pan */ | |
773 | + _dummy_noop2 /* set_vibrato */ | |
774 | +}; | |
775 | + | |
776 | +/* alsa9_rawmidi_detect: | |
777 | + * ALSA9 RawMIDI detection. | |
778 | + */ | |
779 | +static int alsa9_rawmidi_detect(int input) | |
780 | +{ | |
781 | + int card = -1; | |
782 | + int device = -1; | |
783 | + int ret = FALSE, err; | |
784 | + char tmp1[128], tmp2[128], temp[256]; | |
785 | + snd_rawmidi_t *handle = NULL; | |
786 | + char pcm_name[128]; | |
787 | + | |
788 | + if(input) { | |
789 | + /* Input not supported. | |
790 | + card = get_config_int(uconvert_ascii("sound", tmp1), | |
791 | + uconvert_ascii("alsa_rawmidi_input_card", tmp2), | |
792 | + 0); // snd_defaults_rawmidi_card()); | |
793 | + | |
794 | + device = get_config_int(uconvert_ascii("sound", tmp1), | |
795 | + uconvert_ascii("alsa_rawmidi_input_device", tmp2), | |
796 | + 0); // snd_defaults_rawmidi_device()); | |
797 | + | |
798 | + sprintf(pcm_name,"plughw:%d,%d",card,device); | |
799 | + if ((err = snd_rawmidi_open(&handle, NULL,pcm_name, SND_RAWMIDI_OPEN_INPUT)) < 0) { | |
800 | + snprintf(temp, sizeof(temp), "Could not open card/rawmidi device: %s", snd_strerror(err)); | |
801 | + ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE, get_config_text(temp)); | |
802 | + ret = FALSE; | |
803 | + } | |
804 | + | |
805 | + snd_rawmidi_close(handle); | |
806 | + */ | |
807 | + ret = FALSE; | |
808 | + | |
809 | + } | |
810 | + else { | |
811 | + | |
812 | + card = get_config_int(uconvert_ascii("sound", tmp1), | |
813 | + uconvert_ascii("alsa_rawmidi_card", tmp2), | |
814 | + 0); // snd_defaults_rawmidi_card()); | |
815 | + | |
816 | + device = get_config_int(uconvert_ascii("sound", tmp1), | |
817 | + uconvert_ascii("alsa_rawmidi_device", tmp2), | |
818 | + 0); // snd_defaults_rawmidi_device()); | |
819 | + | |
820 | + sprintf(pcm_name,"plughw:%d,%d",card,device); | |
821 | +// if ((err = snd_rawmidi_open(NULL,&handle, pcm_name, SND_RAWMIDI_APPEND)) < 0) { | |
822 | + if ((err = snd_rawmidi_open(NULL,&handle, "default", SND_RAWMIDI_APPEND)) < 0) { | |
823 | + snprintf(temp, sizeof(temp), "Could not open card/rawmidi device: %s", snd_strerror(err)); | |
824 | + ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE, get_config_text(temp)); | |
825 | + ret = FALSE; | |
826 | + } | |
827 | + | |
828 | + snd_rawmidi_close(handle); | |
829 | + | |
830 | + ret = TRUE; | |
831 | + } | |
832 | + | |
833 | + return ret; | |
834 | +} | |
835 | + | |
836 | +/* alsa9_rawmidi_init: | |
837 | + * Setup the ALSA RawMIDI interface. | |
838 | + */ | |
839 | +static int alsa9_rawmidi_init(int input, int voices) | |
840 | +{ | |
841 | + int card = -1; | |
842 | + int device = -1; | |
843 | + int ret = -1, err; | |
844 | + char tmp1[128], tmp2[128], temp[256]; | |
845 | +// snd_rawmidi_info_t info; | |
846 | + char pcm_name[128]; | |
847 | + | |
848 | + if(input) { | |
849 | + /* Input not supported | |
850 | + card = get_config_int(uconvert_ascii("sound", tmp1), | |
851 | + uconvert_ascii("alsa_rawmidi_input_card", tmp2), | |
852 | + 0); // snd_defaults_rawmidi_card()); | |
853 | + | |
854 | + device = get_config_int(uconvert_ascii("sound", tmp1), | |
855 | + uconvert_ascii("alsa_rawmidi_input_device", tmp2), | |
856 | + 0); // snd_defaults_rawmidi_device()); | |
857 | + | |
858 | + sprintf(pcm_name,"plughw:%d,%d",card,device); | |
859 | + if ((err = snd_rawmidi_open(&rawmidi_handle, NULL,pcm_name, SND_RAWMIDI_OPEN_INPUT)) < 0) { | |
860 | + snprintf(temp, sizeof(temp), "Could not open card/rawmidi device: %s", snd_strerror(err)); | |
861 | + ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE, get_config_text(temp)); | |
862 | + ret = -1; | |
863 | + } | |
864 | + */ | |
865 | + ret = -1; | |
866 | + | |
867 | + } | |
868 | + else { | |
869 | + | |
870 | + card = get_config_int(uconvert_ascii("sound", tmp1), | |
871 | + uconvert_ascii("alsa_rawmidi_card", tmp2), | |
872 | + 0); // snd_defaults_rawmidi_card()); | |
873 | + | |
874 | + device = get_config_int(uconvert_ascii("sound", tmp1), | |
875 | + uconvert_ascii("alsa_rawmidi_device", tmp2), | |
876 | + 0); // snd_defaults_rawmidi_device()); | |
877 | + | |
878 | + sprintf(pcm_name,"plughw:%d,%d",card,device); | |
879 | + | |
880 | +// if ((err = snd_rawmidi_open(NULL,&rawmidi_handle, pcm_name, SND_RAWMIDI_APPEND)) < 0) { | |
881 | + if ((err = snd_rawmidi_open(NULL,&rawmidi_handle, "default", SND_RAWMIDI_APPEND)) < 0) { | |
882 | + snprintf(temp, sizeof(temp), "Could not open card/rawmidi device: %s", snd_strerror(err)); | |
883 | + ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE, get_config_text(temp)); | |
884 | + ret = -1; | |
885 | + } | |
886 | + | |
887 | + ret = 0; | |
888 | + } | |
889 | + | |
890 | + if(rawmidi_handle) { | |
891 | + snd_rawmidi_block_mode(rawmidi_handle, 1); | |
892 | +// snd_rawmidi_info(rawmidi_handle, &info); | |
893 | + | |
894 | +// strcpy(alsa9_rawmidi_desc, info.name); | |
895 | +// midi_alsa9.desc = alsa9_rawmidi_desc; | |
896 | + | |
897 | + LOCK_VARIABLE(alsa9_rawmidi_desc); | |
898 | + LOCK_VARIABLE(rawmidi_handle); | |
899 | + LOCK_VARIABLE(midi_alsa9); | |
900 | + LOCK_FUNCTION(alsa9_rawmidi_output); | |
901 | + } | |
902 | + | |
903 | + return ret; | |
904 | +} | |
905 | + | |
906 | +/* alsa9_rawmidi_exit: | |
907 | + * Clean up. | |
908 | + */ | |
909 | +static void alsa9_rawmidi_exit(int input) | |
910 | +{ | |
911 | + if(rawmidi_handle) { | |
912 | + snd_rawmidi_output_drain(rawmidi_handle); | |
913 | + snd_rawmidi_close(rawmidi_handle); | |
914 | + } | |
915 | + | |
916 | + rawmidi_handle = NULL; | |
917 | +} | |
918 | + | |
919 | +/* alsa9_rawmidi_output: | |
920 | + * Outputs MIDI data. | |
921 | + */ | |
922 | +static void alsa9_rawmidi_output(int data) | |
923 | +{ | |
924 | + int err; | |
925 | + | |
926 | + err = snd_rawmidi_write(rawmidi_handle, &data, sizeof(char)); | |
927 | + | |
928 | +} | |
929 | +END_OF_STATIC_FUNCTION(alsa9_rawmidi_output); | |
930 | + | |
931 | +/* alsa9_rawmidi_input: | |
932 | + * Reads MIDI data. | |
933 | + * not supported... | |
934 | +static INLINE int alsa9_rawmidi_input(void) | |
935 | +{ | |
936 | + char data = 0; | |
937 | + | |
938 | + if(snd_rawmidi_read(rawmidi_handle, &data, sizeof(char)) > 0) | |
939 | + return data; | |
940 | + else | |
941 | + return 0; | |
942 | +} | |
943 | +*/ | |
944 | + | |
945 | +#ifdef ALLEGRO_MODULE | |
946 | + | |
947 | +/* _module_init: | |
948 | + * Called when loaded as a dynamically linked module. | |
949 | + */ | |
950 | +void _module_init(int system_driver) | |
951 | +{ | |
952 | + _unix_register_midi_driver(MIDI_ALSA9, &midi_alsa9, TRUE, TRUE); | |
953 | +} | |
954 | + | |
955 | +#endif /* ALLEGRO_MODULE */ | |
956 | + | |
957 | +#endif /* MIDI_ALSA9 */ | |
958 | + |