Skip to content

VERY experimental Nintendo Switch 2 emulator

C++

dsp_interface: fix sound being played while volume is 0

fearlessTobied009309995f
diff --git a/src/audio_core/stream.cpp b/src/audio_core/stream.cpp
index 874673c4e5..4ce2d374e6 100644
--- a/src/audio_core/stream.cpp
+++ b/src/audio_core/stream.cpp
@@ -68,7 +68,7 @@ static void VolumeAdjustSamples(std::vector<s16>& samples) {
}
// Implementation of a volume slider with a dynamic range of 60 dB
- const float volume_scale_factor{std::exp(6.90775f * volume) * 0.001f};
+ const float volume_scale_factor = volume == 0 ? 0 : std::exp(6.90775f * volume) * 0.001f;
for (auto& sample : samples) {
sample = static_cast<s16>(sample * volume_scale_factor);
}