From 5cb469e318048cf62983ef22dd98c738441c56a3 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Thu, 26 Feb 2026 02:31:06 -0800 Subject: [PATCH] Skip sound playback when master volume is muted Water splash and swimming sounds were bypassing mute because ma_engine_set_volume(0) didn't fully prevent sound creation. Now playSound2D and playSound3D early-return when masterVolume is zero. --- src/audio/audio_engine.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/audio/audio_engine.cpp b/src/audio/audio_engine.cpp index b08d10eb..7fdcb952 100644 --- a/src/audio/audio_engine.cpp +++ b/src/audio/audio_engine.cpp @@ -224,6 +224,7 @@ void AudioEngine::setListenerOrientation(const glm::vec3& forward, const glm::ve bool AudioEngine::playSound2D(const std::vector& wavData, float volume, float pitch) { (void)pitch; if (!initialized_ || !engine_ || wavData.empty()) return false; + if (masterVolume_ <= 0.0f) return false; DecodedWavCacheEntry decoded; if (!decodeWavCached(wavData, decoded) || !decoded.pcmData || decoded.frames == 0) { @@ -308,6 +309,7 @@ bool AudioEngine::playSound2D(const std::string& mpqPath, float volume, float pi bool AudioEngine::playSound3D(const std::vector& wavData, const glm::vec3& position, float volume, float pitch, float maxDistance) { if (!initialized_ || !engine_ || wavData.empty()) return false; + if (masterVolume_ <= 0.0f) return false; DecodedWavCacheEntry decoded; if (!decodeWavCached(wavData, decoded) || !decoded.pcmData || decoded.frames == 0) {