mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
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.
This commit is contained in:
parent
c0c5b75e94
commit
5cb469e318
1 changed files with 2 additions and 0 deletions
|
|
@ -224,6 +224,7 @@ void AudioEngine::setListenerOrientation(const glm::vec3& forward, const glm::ve
|
|||
bool AudioEngine::playSound2D(const std::vector<uint8_t>& 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<uint8_t>& 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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue