From 4eece81b8c914f4ecb323d29890eb788ca1d5f4b Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Sat, 17 Jun 2017 09:44:55 -0700 Subject: [PATCH] GB Audio: Fix square sample range (fixes #546) --- src/gb/audio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gb/audio.c b/src/gb/audio.c index f40646b89..3b384cdf8 100644 --- a/src/gb/audio.c +++ b/src/gb/audio.c @@ -709,7 +709,7 @@ bool _writeEnvelope(struct GBAudioEnvelope* envelope, uint8_t value) { } static void _updateSquareSample(struct GBAudioSquareChannel* ch) { - ch->sample = (ch->control.hi * ch->envelope.currentVolume - 8) * 0x10; + ch->sample = (ch->control.hi * 2 - 1) * ch->envelope.currentVolume * 0x8; } static int32_t _updateSquareChannel(struct GBAudioSquareChannel* ch) {