Explorar o código

audio: take first reported device if no default was specified.

Ryan C. Gordon %!s(int64=2) %!d(string=hai) anos
pai
achega
b60a56d368
Modificáronse 1 ficheiros con 7 adicións e 1 borrados
  1. 7 1
      src/audio/SDL_audio.c

+ 7 - 1
src/audio/SDL_audio.c

@@ -579,7 +579,13 @@ int SDL_InitAudio(const char *driver_name)
         current_audio.default_capture_device_id = default_capture->instance_id;
     }
 
-    // !!! FIXME: if a default is zero but there are devices available, should we just pick the first one?
+    // If no default was _ever_ specified, just take the first device we see, if any.
+    if (!current_audio.default_output_device_id && (current_audio.output_devices != NULL)) {
+        current_audio.default_output_device_id = current_audio.output_devices->instance_id;
+    }
+    if (!current_audio.default_capture_device_id && (current_audio.capture_devices != NULL)) {
+        current_audio.default_capture_device_id = current_audio.capture_devices->instance_id;
+    }
 
     return 0;
 }