macOS: make mute sound actually work (#15128)
Some checks failed
android / build (push) Has been cancelled
cpp_lint / clang_tidy (push) Has been cancelled
linux / gcc_7 (push) Has been cancelled
linux / gcc_14 (push) Has been cancelled
linux / clang_7 (push) Has been cancelled
linux / clang_18 (push) Has been cancelled
linux / clang_11 (PROMETHEUS=1) (push) Has been cancelled
macos / build (push) Has been cancelled
whitespace_checks / trailing_whitespaces (push) Has been cancelled
whitespace_checks / tabs_lua_api_files (push) Has been cancelled
windows / MinGW cross-compiler (${{ matrix.bits }}-bit) (32) (push) Has been cancelled
windows / MinGW cross-compiler (${{ matrix.bits }}-bit) (64) (push) Has been cancelled
windows / VS 2019 ${{ matrix.config.arch }}-${{ matrix.type }} (map[arch:x64 generator:-G'Visual Studio 16 2019' -A x64 vcpkg_triplet:x64-windows], portable) (push) Has been cancelled
windows / VS 2019 ${{ matrix.config.arch }}-${{ matrix.type }} (map[arch:x86 generator:-G'Visual Studio 16 2019' -A Win32 vcpkg_triplet:x86-windows], portable) (push) Has been cancelled

This commit is contained in:
sfence 2024-09-08 13:53:43 +02:00 committed by GitHub
parent 2208fc0632
commit 733a019bf5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -29,6 +29,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "filesys.h"
#include "porting.h"
#include <limits>
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<f32>::min();
#endif
alListenerf(AL_GAIN, gain);
}