Removed ESD cruft from the core...now the driver will use esound if there's SDL-ryan-multiple-audio-device
authorRyan C. Gordon <icculus@icculus.org>
Wed, 04 Oct 2006 22:10:09 +0000
branchSDL-ryan-multiple-audio-device
changeset 3803 3decf9cdeb63
parent 3802 cef5d927591f
child 3804 b12b7ec0dfcc
Removed ESD cruft from the core...now the driver will use esound if there's an ESPEAKER variable set for a remote host, or the daemon is already running on the local host, but it won't spawn it. Hopefully this works out okay.
src/audio/SDL_audio.c
src/audio/esd/SDL_esdaudio.c
--- a/src/audio/SDL_audio.c	Wed Oct 04 21:58:48 2006 +0000
+++ b/src/audio/SDL_audio.c	Wed Oct 04 22:10:09 2006 +0000
@@ -370,48 +370,11 @@
     SDL_memset(&current_audio, '\0', sizeof (current_audio));
     SDL_memset(open_devices, '\0', sizeof (open_devices));
 
-    /* !!! FIXME: build a priority list of available drivers... */
-
     /* Select the proper audio driver */
     if (driver_name == NULL) {
         driver_name = SDL_getenv("SDL_AUDIODRIVER");
     }
 
-/* !!! FIXME: move this esound shite into the esound driver... */
-#if SDL_AUDIO_DRIVER_ESD
-    if ((driver_name == NULL) && (SDL_getenv("ESPEAKER") != NULL)) {
-        /* Ahem, we know that if ESPEAKER is set, user probably wants
-           to use ESD, but don't start it if it's not already running.
-           This probably isn't the place to do this, but... Shh! :)
-         */
-        for (i = 0; bootstrap[i]; ++i) {
-            if (SDL_strcasecmp(bootstrap[i]->name, "esd") == 0) {
-#ifdef HAVE_PUTENV
-                const char *esd_no_spawn;
-
-                /* Don't start ESD if it's not running */
-                esd_no_spawn = getenv("ESD_NO_SPAWN");
-                if (esd_no_spawn == NULL) {
-                    putenv("ESD_NO_SPAWN=1");
-                }
-#endif
-                if (bootstrap[i]->available()) {
-                    SDL_memset(&current_audio, 0, sizeof (current_audio));
-                    current_audio.name = bootstrap[i]->name;
-                    current_audio.desc = bootstrap[i]->desc;
-                    initialized = bootstrap[i]->init(&current_audio.impl);
-                    break;
-                }
-#ifdef HAVE_UNSETENV
-                if (esd_no_spawn == NULL) {
-                    unsetenv("ESD_NO_SPAWN");
-                }
-#endif
-            }
-        }
-    }
-#endif /* SDL_AUDIO_DRIVER_ESD */
-
     if (!initialized) {
         if (driver_name != NULL) {
             for (i = 0; bootstrap[i]; ++i) {
--- a/src/audio/esd/SDL_esdaudio.c	Wed Oct 04 21:58:48 2006 +0000
+++ b/src/audio/esd/SDL_esdaudio.c	Wed Oct 04 22:10:09 2006 +0000
@@ -126,10 +126,14 @@
 static int
 Audio_Available(void)
 {
-    int connection;
-    int available;
+    const char *esd_no_spawn = SDL_getenv("ESD_NO_SPAWN");
+    int connection = 0;
+    int available = 0;
 
-    available = 0;
+    if (esd_no_spawn == NULL) {
+        SDL_putenv("ESD_NO_SPAWN=1"); /* Don't start ESD if it's not running */
+    }
+
     if (LoadESDLibrary() < 0) {
         return available;
     }
@@ -139,7 +143,7 @@
         SDL_NAME(esd_close) (connection);
     }
     UnloadESDLibrary();
-    return (available);
+    return available;
 }
 
 static void