33 #include <os2.h> |
33 #include <os2.h> |
34 #endif |
34 #endif |
35 |
35 |
36 /* Available audio drivers */ |
36 /* Available audio drivers */ |
37 static AudioBootStrap *bootstrap[] = { |
37 static AudioBootStrap *bootstrap[] = { |
38 #ifdef OPENBSD_AUDIO_SUPPORT |
38 #if SDL_AUDIO_DRIVER_OPENBSD |
39 &OPENBSD_AUDIO_bootstrap, |
39 &OPENBSD_AUDIO_bootstrap, |
40 #endif |
40 #endif |
41 #ifdef OSS_SUPPORT |
41 #if SDL_AUDIO_DRIVER_OSS |
42 &DSP_bootstrap, |
42 &DSP_bootstrap, |
43 &DMA_bootstrap, |
43 &DMA_bootstrap, |
44 #endif |
44 #endif |
45 #ifdef ALSA_SUPPORT |
45 #if SDL_AUDIO_DRIVER_ALSA |
46 &ALSA_bootstrap, |
46 &ALSA_bootstrap, |
47 #endif |
47 #endif |
48 #ifdef QNXNTOAUDIO_SUPPORT |
48 #if SDL_AUDIO_DRIVER_QNXNTO |
49 &QNXNTOAUDIO_bootstrap, |
49 &QNXNTOAUDIO_bootstrap, |
50 #endif |
50 #endif |
51 #ifdef SUNAUDIO_SUPPORT |
51 #if SDL_AUDIO_DRIVER_SUNAUDIO |
52 &SUNAUDIO_bootstrap, |
52 &SUNAUDIO_bootstrap, |
53 #endif |
53 #endif |
54 #ifdef DMEDIA_SUPPORT |
54 #if SDL_AUDIO_DRIVER_DMEDIA |
55 &DMEDIA_bootstrap, |
55 &DMEDIA_bootstrap, |
56 #endif |
56 #endif |
57 #ifdef ARTSC_SUPPORT |
57 #if SDL_AUDIO_DRIVER_ARTS |
58 &ARTSC_bootstrap, |
58 &ARTS_bootstrap, |
59 #endif |
59 #endif |
60 #ifdef ESD_SUPPORT |
60 #if SDL_AUDIO_DRIVER_ESD |
61 &ESD_bootstrap, |
61 &ESD_bootstrap, |
62 #endif |
62 #endif |
63 #ifdef NAS_SUPPORT |
63 #if SDL_AUDIO_DRIVER_NAS |
64 &NAS_bootstrap, |
64 &NAS_bootstrap, |
65 #endif |
65 #endif |
66 #ifdef ENABLE_DIRECTX |
66 #if SDL_AUDIO_DRIVER_DSOUND |
67 &DSOUND_bootstrap, |
67 &DSOUND_bootstrap, |
68 #endif |
68 #endif |
69 #ifdef ENABLE_WINDIB |
69 #if SDL_AUDIO_DRIVER_WAVEOUT |
70 &WAVEOUT_bootstrap, |
70 &WAVEOUT_bootstrap, |
71 #endif |
71 #endif |
72 #ifdef __BEOS__ |
72 #if SDL_AUDIO_DRIVER_PAUD |
|
73 &Paud_bootstrap, |
|
74 #endif |
|
75 #if SDL_AUDIO_DRIVER_BAUDIO |
73 &BAUDIO_bootstrap, |
76 &BAUDIO_bootstrap, |
74 #endif |
77 #endif |
75 #ifdef MACOSX |
78 #if SDL_AUDIO_DRIVER_COREAUDIO |
76 &COREAUDIO_bootstrap, |
79 &COREAUDIO_bootstrap, |
77 #endif |
80 #endif |
78 #if defined(macintosh) || TARGET_API_MAC_CARBON |
81 #if SDL_AUDIO_DRIVER_SNDMGR |
79 &SNDMGR_bootstrap, |
82 &SNDMGR_bootstrap, |
80 #endif |
83 #endif |
81 #ifdef _AIX |
84 #if SDL_AUDIO_DRIVER_AHI |
82 &Paud_bootstrap, |
|
83 #endif |
|
84 #ifdef ENABLE_AHI |
|
85 &AHI_bootstrap, |
85 &AHI_bootstrap, |
86 #endif |
86 #endif |
87 #ifdef MMEAUDIO_SUPPORT |
87 #if SDL_AUDIO_DRIVER_MINT |
88 &MMEAUDIO_bootstrap, |
|
89 #endif |
|
90 #ifdef MINTAUDIO_SUPPORT |
|
91 &MINTAUDIO_GSXB_bootstrap, |
88 &MINTAUDIO_GSXB_bootstrap, |
92 &MINTAUDIO_MCSN_bootstrap, |
89 &MINTAUDIO_MCSN_bootstrap, |
93 &MINTAUDIO_STFA_bootstrap, |
90 &MINTAUDIO_STFA_bootstrap, |
94 &MINTAUDIO_XBIOS_bootstrap, |
91 &MINTAUDIO_XBIOS_bootstrap, |
95 &MINTAUDIO_DMA8_bootstrap, |
92 &MINTAUDIO_DMA8_bootstrap, |
96 #endif |
93 #endif |
97 #ifdef DISKAUD_SUPPORT |
94 #if SDL_AUDIO_DRIVER_DISK |
98 &DISKAUD_bootstrap, |
95 &DISKAUD_bootstrap, |
99 #endif |
96 #endif |
100 #ifdef ENABLE_DC |
97 #if SDL_AUDIO_DRIVER_DC |
101 &DCAUD_bootstrap, |
98 &DCAUD_bootstrap, |
102 #endif |
99 #endif |
103 #ifdef DRENDERER_SUPPORT |
100 #if SDL_AUDIO_DRIVER_DRENDERER |
104 &DRENDERER_bootstrap, |
101 &DRENDERER_bootstrap, |
105 #endif |
102 #endif |
106 #ifdef __OS2__ |
103 #if SDL_AUDIO_DRIVER_MMEAUDIO |
107 &DART_bootstrap, |
104 &MMEAUDIO_bootstrap, |
|
105 #endif |
|
106 #if SDL_AUDIO_DRIVER_DART |
|
107 &DART_bootstrap, |
108 #endif |
108 #endif |
109 NULL |
109 NULL |
110 }; |
110 }; |
111 SDL_AudioDevice *current_audio = NULL; |
111 SDL_AudioDevice *current_audio = NULL; |
112 |
112 |
292 } |
292 } |
293 |
293 |
294 /* Select the proper audio driver */ |
294 /* Select the proper audio driver */ |
295 audio = NULL; |
295 audio = NULL; |
296 idx = 0; |
296 idx = 0; |
297 #ifdef unix |
297 #if SDL_AUDIO_DRIVER_ESD |
298 if ( (driver_name == NULL) && (SDL_getenv("ESPEAKER") != NULL) ) { |
298 if ( (driver_name == NULL) && (SDL_getenv("ESPEAKER") != NULL) ) { |
299 /* Ahem, we know that if ESPEAKER is set, user probably wants |
299 /* Ahem, we know that if ESPEAKER is set, user probably wants |
300 to use ESD, but don't start it if it's not already running. |
300 to use ESD, but don't start it if it's not already running. |
301 This probably isn't the place to do this, but... Shh! :) |
301 This probably isn't the place to do this, but... Shh! :) |
302 */ |
302 */ |
321 } |
321 } |
322 #endif |
322 #endif |
323 } |
323 } |
324 } |
324 } |
325 } |
325 } |
326 #endif /* unix */ |
326 #endif /* SDL_AUDIO_DRIVER_ESD */ |
327 if ( audio == NULL ) { |
327 if ( audio == NULL ) { |
328 if ( driver_name != NULL ) { |
328 if ( driver_name != NULL ) { |
329 #if 0 /* This will be replaced with a better driver selection API */ |
329 #if 0 /* This will be replaced with a better driver selection API */ |
330 if ( SDL_strrchr(driver_name, ':') != NULL ) { |
330 if ( SDL_strrchr(driver_name, ':') != NULL ) { |
331 idx = atoi(SDL_strrchr(driver_name, ':')+1); |
331 idx = atoi(SDL_strrchr(driver_name, ':')+1); |
412 default: |
412 default: |
413 SDL_SetError("1 (mono) and 2 (stereo) channels supported"); |
413 SDL_SetError("1 (mono) and 2 (stereo) channels supported"); |
414 return(-1); |
414 return(-1); |
415 } |
415 } |
416 |
416 |
417 #if defined(macintosh) || (defined(__riscos__) && defined(DISABLE_THREADS)) |
417 #if defined(macintosh) || (defined(__riscos__) && SDL_THREADS_DISABLED) |
418 /* FIXME: Need to implement PPC interrupt asm for SDL_LockAudio() */ |
418 /* FIXME: Need to implement PPC interrupt asm for SDL_LockAudio() */ |
419 #else |
419 #else |
420 #if defined(__MINT__) && !defined(ENABLE_THREADS) |
420 #if defined(__MINT__) && SDL_THREADS_DISABLED |
421 /* Uses interrupt driven audio, without thread */ |
421 /* Uses interrupt driven audio, without thread */ |
422 #else |
422 #else |
423 /* Create a semaphore for locking the sound buffers */ |
423 /* Create a semaphore for locking the sound buffers */ |
424 audio->mixer_lock = SDL_CreateMutex(); |
424 audio->mixer_lock = SDL_CreateMutex(); |
425 if ( audio->mixer_lock == NULL ) { |
425 if ( audio->mixer_lock == NULL ) { |