sdl2-compat: fixed setting the wrong audio device to NULL

From 1aa5a8796bbd500659528a8d73d973b54bbab925 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Mon, 7 Aug 2023 21:51:35 -0700
Subject: [PATCH] fixed setting the wrong audio device to NULL

---
 src/sdl2_compat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/sdl2_compat.c b/src/sdl2_compat.c
index 26b4fe0..3991dfa 100644
--- a/src/sdl2_compat.c
+++ b/src/sdl2_compat.c
@@ -4280,7 +4280,7 @@ SDL_CloseAudioDevice(SDL_AudioDeviceID dev)
     if (stream2) {
         SDL3_CloseAudioDevice(SDL3_GetAudioStreamBinding(stream2->stream3));
         SDL_FreeAudioStream(stream2);
-        AudioOpenDevices[dev] = NULL;  /* this doesn't hold a lock in SDL2, either; the lock only prevents two racing opens from getting the same id. We can NULL it whenever, though. */
+        AudioOpenDevices[dev - 1] = NULL;  /* this doesn't hold a lock in SDL2, either; the lock only prevents two racing opens from getting the same id. We can NULL it whenever, though. */
     }
 }