sdl2-compat: Give SDL2 applications the audio spec they expect

From b2d2190946b4c15ba0ef425f8a54ba6f9056fd2e Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Wed, 29 Jan 2025 17:38:32 -0800
Subject: [PATCH] Give SDL2 applications the audio spec they expect

Fixes https://github.com/libsdl-org/sdl2-compat/issues/176
---
 src/sdl2_compat.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/sdl2_compat.c b/src/sdl2_compat.c
index 2d1469b..2a4c1a2 100644
--- a/src/sdl2_compat.c
+++ b/src/sdl2_compat.c
@@ -5699,6 +5699,12 @@ static SDL_AudioDeviceID OpenAudioDeviceLocked(const char *devicename, int iscap
 
     SDL_assert(obtained2 != NULL);  /* we checked this before locking. */
 
+    /* Source 1 games pass SDL_AUDIO_ALLOW_ANY_CHANGE, but can't actually handle change.
+       It's probably safer just to give the app back what they expect, and SDL3 will
+       handle conversion, possibly more efficiently.
+     */
+    allowed_changes = 0;
+
     /* Find an available device ID... */
     for (id = min_id - 1; id < (int)SDL_arraysize(AudioOpenDevices); id++) {
         if (AudioOpenDevices[id] == NULL) {