diff options
author | Kelebek1 <eeeedddccc@hotmail.co.uk> | 2021-07-08 15:23:49 +0200 |
---|---|---|
committer | Kelebek1 <eeeedddccc@hotmail.co.uk> | 2021-07-08 18:42:15 +0200 |
commit | 7905eb025432a2d46deb6352ea29979c380c1cf9 (patch) | |
tree | 82af0a83027f8edcb486c3db5b1aae8d20929158 /src/audio_core/command_generator.cpp | |
parent | Merge pull request #6569 from Kelebek1/Vol (diff) | |
download | yuzu-7905eb025432a2d46deb6352ea29979c380c1cf9.tar yuzu-7905eb025432a2d46deb6352ea29979c380c1cf9.tar.gz yuzu-7905eb025432a2d46deb6352ea29979c380c1cf9.tar.bz2 yuzu-7905eb025432a2d46deb6352ea29979c380c1cf9.tar.lz yuzu-7905eb025432a2d46deb6352ea29979c380c1cf9.tar.xz yuzu-7905eb025432a2d46deb6352ea29979c380c1cf9.tar.zst yuzu-7905eb025432a2d46deb6352ea29979c380c1cf9.zip |
Diffstat (limited to 'src/audio_core/command_generator.cpp')
-rw-r--r-- | src/audio_core/command_generator.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/audio_core/command_generator.cpp b/src/audio_core/command_generator.cpp index 1402ff280..02c6e6f6a 100644 --- a/src/audio_core/command_generator.cpp +++ b/src/audio_core/command_generator.cpp @@ -42,6 +42,15 @@ void ApplyMix(std::span<s32> output, std::span<const s32> input, s32 gain, s32 s s32 ApplyMixRamp(std::span<s32> output, std::span<const s32> input, float gain, float delta, s32 sample_count) { + // XC2 passes in NaN mix volumes, causing further issues as we handle everything as s32 rather + // than float, so the NaN propogation is lost. As the samples get further modified for + // volume etc, they can get out of NaN range, so a later heuristic for catching this is + // more difficult. Handle it here by setting these samples to silence. + if (std::isnan(gain)) { + gain = 0.0f; + delta = 0.0f; + } + s32 x = 0; for (s32 i = 0; i < sample_count; i++) { x = static_cast<s32>(static_cast<float>(input[i]) * gain); |