macOS: make mute sound actually work (#15128)

This commit is contained in:
sfence 2024-09-08 13:53:43 +02:00 committed by SmallJoker
parent e27757fa3a
commit 73c29e7763

@ -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);
}