diff src/audio/SDL_audio.c @ 3699:4160ba33b597

Removed test for "driver is valid, but doesn't see any audio devices." It was causing problems, and it really doesn't make sense to do it that way. Fixes Bugzilla #834.
author Ryan C. Gordon <icculus@icculus.org>
date Tue, 26 Jan 2010 06:01:33 +0000
parents f7b03b6838cb
children 791b3256fb22 79aa6c61f33b
line wrap: on
line diff
--- a/src/audio/SDL_audio.c	Sun Jan 24 21:13:33 2010 +0000
+++ b/src/audio/SDL_audio.c	Tue Jan 26 06:01:33 2010 +0000
@@ -581,8 +581,6 @@
     int i = 0;
     int initialized = 0;
     int tried_to_init = 0;
-    int rc = 0;
-    int best_choice = -1;
 
     if (SDL_WasInit(SDL_INIT_AUDIO)) {
         SDL_AudioQuit();        /* shutdown driver if already running. */
@@ -608,34 +606,14 @@
         SDL_memset(&current_audio, 0, sizeof(current_audio));
         current_audio.name = backend->name;
         current_audio.desc = backend->desc;
-        rc = backend->init(&current_audio.impl);
-        if (rc == 2) {          /* init'd, and devices available. Take it! */
-            initialized = 1;
-            best_choice = i;
-        } else if (rc == 1) {   /* init'd, but can't see any devices. */
-            if (current_audio.impl.Deinitialize) {
-                current_audio.impl.Deinitialize();
-            }
-            if (best_choice == -1) {
-                best_choice = i;
-            }
-        }
-    }
-
-    /* No definite choice. Pick one that works but can't promise a device. */
-    if ((!initialized) && (best_choice != -1)) {
-        const AudioBootStrap *backend = bootstrap[best_choice];
-        SDL_memset(&current_audio, 0, sizeof(current_audio));
-        current_audio.name = backend->name;
-        current_audio.desc = backend->desc;
-        initialized = (backend->init(&current_audio.impl) > 0);
+        initialized = backend->init(&current_audio.impl);
     }
 
     if (!initialized) {
         /* specific drivers will set the error message if they fail... */
         if (!tried_to_init) {
             if (driver_name) {
-                SDL_SetError("%s not available", driver_name);
+                SDL_SetError("Audio target '%s' not available", driver_name);
             } else {
                 SDL_SetError("No available audio device");
             }