From e58e665a0346a2325a1df9b776b1cec2e4396e93 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Wed, 22 Apr 2026 22:32:46 -0700
Subject: [PATCH] Fall back to dummy audio if audio stream creation fails
---
maclib/Mac_Sound.cpp | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/maclib/Mac_Sound.cpp b/maclib/Mac_Sound.cpp
index 1fedcb11..1083aea8 100644
--- a/maclib/Mac_Sound.cpp
+++ b/maclib/Mac_Sound.cpp
@@ -48,6 +48,13 @@ Sound:: Sound(const char *soundfile, Uint8 vol) : ErrorBase()
SDL_AudioSpec spec = { SDL_AUDIO_U8, 1, DSP_FREQUENCY };
stream = SDL_OpenAudioDeviceStream(SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK, &spec, FillAudio, this);
+ if (!stream) {
+ // Fall back to dummy audio so our callback runs
+ SDL_QuitSubSystem(SDL_INIT_AUDIO);
+ SDL_SetHint(SDL_HINT_AUDIO_DRIVER, "dummy");
+ SDL_InitSubSystem(SDL_INIT_AUDIO);
+ stream = SDL_OpenAudioDeviceStream(SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK, &spec, FillAudio, this);
+ }
/* Empty the channels and start the music :-) */
HaltSound();