diff src/audio/SDL_audio.c @ 3801:e17a59e6aff6 SDL-ryan-multiple-audio-device

Removed AmigaOS audio driver from 1.3; it hasn't compiled for years, and it adds a lot of cruft to the core.
author Ryan C. Gordon <icculus@icculus.org>
date Wed, 04 Oct 2006 21:54:57 +0000
parents c8b3d3d13ed1
children cef5d927591f
line wrap: on
line diff
--- a/src/audio/SDL_audio.c	Wed Oct 04 21:39:45 2006 +0000
+++ b/src/audio/SDL_audio.c	Wed Oct 04 21:54:57 2006 +0000
@@ -67,7 +67,6 @@
 extern AudioBootStrap BAUDIO_bootstrap;
 extern AudioBootStrap COREAUDIO_bootstrap;
 extern AudioBootStrap SNDMGR_bootstrap;
-extern AudioBootStrap AHI_bootstrap;
 extern AudioBootStrap MINTAUDIO_GSXB_bootstrap;
 extern AudioBootStrap MINTAUDIO_MCSN_bootstrap;
 extern AudioBootStrap MINTAUDIO_STFA_bootstrap;
@@ -128,9 +127,6 @@
 #if SDL_AUDIO_DRIVER_SNDMGR
     &SNDMGR_bootstrap,
 #endif
-#if SDL_AUDIO_DRIVER_AHI
-    &AHI_bootstrap,
-#endif
 #if SDL_AUDIO_DRIVER_MINT
     &MINTAUDIO_GSXB_bootstrap,
     &MINTAUDIO_MCSN_bootstrap,
@@ -156,10 +152,6 @@
     NULL
 };
 
-#if SDL_AUDIO_DRIVER_AHI
-static int audio_configured = 0;
-#endif
-
 static SDL_AudioDevice *get_audio_device(SDL_AudioDeviceID id)
 {
     id--;
@@ -252,23 +244,6 @@
     void (SDLCALL * fill) (void *userdata, Uint8 * stream, int len);
     int silence;
 
-/* !!! FIXME: can we push this into the Amiga driver? */
-#if SDL_AUDIO_DRIVER_AHI
-#error this is probably broken.
-    int started = 0;
-
-/* AmigaOS NEEDS that the audio driver is opened in the thread that uses it! */
-
-    D(bug("Task audio started audio struct:<%lx>...\n", audiop));
-
-    D(bug("Before Openaudio..."));
-    if (audio->OpenAudio(audio, &audio->spec) == -1) {
-        D(bug("Open audio failed...\n"));
-        return (-1);
-    }
-    D(bug("OpenAudio...OK\n"));
-#endif
-
     /* Perform any thread setup */
     device->threadid = SDL_ThreadID();
     current_audio.impl.ThreadInit(device);
@@ -277,14 +252,6 @@
     fill = device->spec.callback;
     udata = device->spec.userdata;
 
-#if SDL_AUDIO_DRIVER_AHI
-    audio_configured = 1;
-
-    D(bug("Audio configured... Checking for conversion\n"));
-    SDL_mutexP(audio->mixer_lock);
-    D(bug("Semaphore obtained...\n"));
-#endif
-
     if (device->convert.needed) {
         if (device->convert.src_format == AUDIO_U8) {
             silence = 0x80;
@@ -297,11 +264,6 @@
         stream_len = device->spec.size;
     }
 
-#if SDL_AUDIO_DRIVER_AHI
-    SDL_mutexV(device->mixer_lock);
-    D(bug("Entering audio loop...\n"));
-#endif
-
     /* Loop, filling the audio buffers */
     while (device->enabled) {
 
@@ -356,15 +318,6 @@
     /* Wait for the audio to drain.. */
     current_audio.impl.WaitDone(device);
 
-/* !!! FIXME: get this out of core. */
-#if SDL_AUDIO_DRIVER_AHI
-    D(bug("WaitDevice...Done\n"));
-    current_audio.impl.CloseDevice(device);
-    device->opened = 0;
-    D(bug("CloseDevice..Done, subtask exiting...\n"));
-    audio_configured = 0;
-#endif
-
     return (0);
 }
 
@@ -748,34 +701,11 @@
         }
     }
 
-/* !!! FIXME: Get this #if out of the core. */
-/* AmigaOS opens audio inside the main loop */
-#if !SDL_AUDIO_DRIVER_AHI
     if (!current_audio.impl.OpenDevice(device, devname, iscapture)) {
         close_audio_device(device);
         return 0;
     }
     device->opened = 1;
-#else
-#   error needs to be fixed for new internal API. Email Ryan for details.
-
-    D(bug("Locking semaphore..."));
-    SDL_mutexP(audio->mixer_lock);
-
-
-    audio->thread = SDL_CreateThread(SDL_RunAudio, audio);
-    D(bug("Created thread...\n"));
-
-    if (audio->thread == NULL) {
-        SDL_mutexV(audio->mixer_lock);
-        SDL_CloseAudio();
-        SDL_SetError("Couldn't create audio thread");
-        return 0;
-    }
-
-    while (!audio_configured)
-        SDL_Delay(100);
-#endif
 
     /* If the audio driver changes the buffer size, accept it */
     if (device->spec.samples != desired.samples) {
@@ -834,8 +764,6 @@
         return 0;
     }
 
-/* !!! FIXME: get this out of core. */
-#if !SDL_AUDIO_DRIVER_AHI
     /* Start the audio thread if necessary */
     if (!current_audio.impl.ProvidesOwnCallbackThread) {
         /* Start the audio thread */
@@ -853,12 +781,6 @@
         }
     }
 
-#else
-    SDL_mutexV(audio->mixer_lock);
-    D(bug("SDL_OpenAudio USCITA...\n"));
-
-#endif
-
     return id+1;
 }