diff src/audio/SDL_audio.c @ 1909:8f1ab2f7c722

Look at environment variables in SDL_VideoInit() and SDL_AudioInit()
author Sam Lantinga <slouken@libsdl.org>
date Sat, 15 Jul 2006 19:30:18 +0000
parents f132024010be
children 542c78b6fb12
line wrap: on
line diff
--- a/src/audio/SDL_audio.c	Sat Jul 15 19:29:42 2006 +0000
+++ b/src/audio/SDL_audio.c	Sat Jul 15 19:30:18 2006 +0000
@@ -361,6 +361,9 @@
     /* Select the proper audio driver */
     audio = NULL;
     idx = 0;
+    if (driver_name == NULL) {
+        driver_name = SDL_getenv("SDL_AUDIODRIVER");
+    }
 #if SDL_AUDIO_DRIVER_ESD
     if ((driver_name == NULL) && (SDL_getenv("ESPEAKER") != NULL)) {
         /* Ahem, we know that if ESPEAKER is set, user probably wants
@@ -393,11 +396,6 @@
 #endif /* SDL_AUDIO_DRIVER_ESD */
     if (audio == NULL) {
         if (driver_name != NULL) {
-#if 0                           /* This will be replaced with a better driver selection API */
-            if (SDL_strrchr(driver_name, ':') != NULL) {
-                idx = atoi(SDL_strrchr(driver_name, ':') + 1);
-            }
-#endif
             for (i = 0; bootstrap[i]; ++i) {
                 if (SDL_strncmp(bootstrap[i]->name, driver_name,
                                 SDL_strlen(bootstrap[i]->name)) == 0) {
@@ -423,9 +421,10 @@
             } else {
                 SDL_SetError("No available audio device");
             }
-#if 0                           /* Don't fail SDL_Init() if audio isn't available.
-                                   SDL_OpenAudio() will handle it at that point.  *sigh*
-                                 */
+#if 0
+            /* Don't fail SDL_Init() if audio isn't available.
+               SDL_OpenAudio() will handle it at that point.  *sigh*
+             */
             return (-1);
 #endif
         }