SDL_mixer: Don't set the mixing callback until we've initialized our channels

From 6d5c7a65c43c1729db1659239e658c3c584e3786 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Tue, 3 Dec 2024 16:07:57 -0800
Subject: [PATCH] Don't set the mixing callback until we've initialized our
 channels

---
 src/mixer.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/mixer.c b/src/mixer.c
index 334007e6..c5f61524 100644
--- a/src/mixer.c
+++ b/src/mixer.c
@@ -517,9 +517,6 @@ bool Mix_OpenAudio(SDL_AudioDeviceID devid, const SDL_AudioSpec *spec)
         return false;
     }
 
-    SDL_BindAudioStream(audio_device, audio_stream);
-    SDL_SetAudioStreamGetCallback(audio_stream, mix_channels, NULL);
-
 #if 0
     PrintFormat("Audio device", &mixer);
 #endif
@@ -552,6 +549,9 @@ bool Mix_OpenAudio(SDL_AudioDeviceID devid, const SDL_AudioSpec *spec)
     /* Initialize the music players */
     open_music(&mixer);
 
+    SDL_BindAudioStream(audio_device, audio_stream);
+    SDL_SetAudioStreamGetCallback(audio_stream, mix_channels, NULL);
+
     audio_opened = 1;
     return true;
 }