From b9326918103b44dd8e1337d36f3e098dd65cf46c Mon Sep 17 00:00:00 2001 From: Tillmann Karras Date: Sat, 18 May 2024 03:32:07 +0100 Subject: [PATCH] DSPHLE/Zelda: fix Pikmin 2 save sound (issue 8855) --- Source/Core/Core/HW/DSPHLE/UCodes/Zelda.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/Zelda.cpp b/Source/Core/Core/HW/DSPHLE/UCodes/Zelda.cpp index 6be1ef0ef9..f1472807a1 100644 --- a/Source/Core/Core/HW/DSPHLE/UCodes/Zelda.cpp +++ b/Source/Core/Core/HW/DSPHLE/UCodes/Zelda.cpp @@ -1407,12 +1407,13 @@ void ZeldaAudioRenderer::LoadInputSamples(MixingBuffer* buffer, VPB* vpb) else shift = 2; u32 mask = (1 << shift) - 1; + u32 ratio = vpb->resampling_ratio << (shift - 1); u32 pos = vpb->current_pos_frac << shift; for (s16& sample : *buffer) { sample = ((pos >> 16) & mask) ? 0xC000 : 0x4000; - pos += vpb->resampling_ratio; + pos += ratio; } vpb->current_pos_frac = (pos >> shift) & 0xFFFF; break;