From b60a56d368afe4401740a522bcccca70ea13e0f4 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Mon, 3 Jul 2023 11:38:17 -0400 Subject: [PATCH] audio: take first reported device if no default was specified. --- src/audio/SDL_audio.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c index 77f5c2d86c..56e7ac113b 100644 --- a/src/audio/SDL_audio.c +++ b/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; }