GB Audio: Fix frame sequencer timing in double speed mode (fixes #2071)
Vicki Pfau vi@endrift.com
Mon, 22 Mar 2021 18:42:44 -0700
1 files changed,
2 insertions(+),
2 deletions(-)
jump to
M
src/gb/timer.c
→
src/gb/timer.c
@@ -31,7 +31,7 @@ if (!timer->p->memory.io[GB_REG_TIMA]) {
mTimingSchedule(&timer->p->timing, &timer->irq, 7 * tMultiplier - ((timer->p->cpu->executionState * tMultiplier - cyclesLate) & (3 * tMultiplier))); } } - unsigned timingFactor = 0x1FF; + unsigned timingFactor = (0x200 << timer->p->doubleSpeed) - 1; if ((timer->internalDiv & timingFactor) == timingFactor) { GBAudioUpdateFrame(&timer->p->audio); }@@ -82,7 +82,7 @@ if (!timer->p->memory.io[GB_REG_TIMA]) {
mTimingSchedule(&timer->p->timing, &timer->irq, (7 - (timer->p->cpu->executionState & 3)) * tMultiplier); } } - if (timer->internalDiv & 0x200) { + if (timer->internalDiv & (0x200 << timer->p->doubleSpeed)) { GBAudioUpdateFrame(&timer->p->audio); } timer->p->memory.io[GB_REG_DIV] = 0;