From 73c29e7763488bbde04ea5fa3221ea66c25465bc Mon Sep 17 00:00:00 2001 From: sfence Date: Sun, 8 Sep 2024 13:53:43 +0200 Subject: [PATCH] macOS: make mute sound actually work (#15128) --- src/client/sound/sound_manager.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/client/sound/sound_manager.cpp b/src/client/sound/sound_manager.cpp index 679d3a155..6aae5bb7f 100644 --- a/src/client/sound/sound_manager.cpp +++ b/src/client/sound/sound_manager.cpp @@ -29,6 +29,8 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "filesys.h" #include "porting.h" +#include + namespace sound { void OpenALSoundManager::stepStreams(f32 dtime) @@ -347,6 +349,13 @@ void OpenALSoundManager::updateListener(const v3f &pos_, const v3f &vel_, void OpenALSoundManager::setListenerGain(f32 gain) { +#if defined(__APPLE__) + /* macOS OpenAL implementation ignore setting AL_GAIN to zero + * so we use smallest possible value + */ + if (gain == 0.0f) + gain = std::numeric_limits::min(); +#endif alListenerf(AL_GAIN, gain); }