Merge pull request #12783 from Tilka/zelda_square

DSPHLE/Zelda: fix Pikmin 2 save sound (issue 8855)
This commit is contained in:
JMC47 2024-08-11 14:16:28 -04:00 committed by GitHub
commit e4bd14257f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1407,12 +1407,13 @@ void ZeldaAudioRenderer::LoadInputSamples(MixingBuffer* buffer, VPB* vpb)
else else
shift = 2; shift = 2;
u32 mask = (1 << shift) - 1; u32 mask = (1 << shift) - 1;
u32 ratio = vpb->resampling_ratio << (shift - 1);
u32 pos = vpb->current_pos_frac << shift; u32 pos = vpb->current_pos_frac << shift;
for (s16& sample : *buffer) for (s16& sample : *buffer)
{ {
sample = ((pos >> 16) & mask) ? 0xC000 : 0x4000; sample = ((pos >> 16) & mask) ? 0xC000 : 0x4000;
pos += vpb->resampling_ratio; pos += ratio;
} }
vpb->current_pos_frac = (pos >> shift) & 0xFFFF; vpb->current_pos_frac = (pos >> shift) & 0xFFFF;
break; break;