From 01abeb013b498a4a8780cf6c9bb66eb745d7b3a8 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Sat, 8 Jul 2017 22:02:44 -0700 Subject: [PATCH] GB Audio: Fix incorrect channel 4 iteration --- CHANGES | 1 + src/gb/audio.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index d5fee601f..d2e597da7 100644 --- a/CHANGES +++ b/CHANGES @@ -167,6 +167,7 @@ Bugfixes: - Qt: Fix patch loading while a game is running - Qt: Fix shader selector on Ubuntu (fixes mgba.io/i/767) - GB Serialize: Fix timer serialization + - GB Audio: Fix incorrect channel 4 iteration Misc: - Qt: Add language selector - GBA Timer: Improve accuracy of timers diff --git a/src/gb/audio.c b/src/gb/audio.c index 3b384cdf8..6a9abe0c7 100644 --- a/src/gb/audio.c +++ b/src/gb/audio.c @@ -893,7 +893,7 @@ static void _updateChannel4(struct mTiming* timing, void* user, uint32_t cyclesL ch->lfsr >>= 1; ch->lfsr ^= (lsb * 0x60) << (ch->power ? 0 : 8); cycles += baseCycles; - } while (cycles < audio->sampleInterval); + } while (cycles + baseCycles < audio->sampleInterval); mTimingSchedule(timing, &audio->ch4Event, cycles - cyclesLate); }