summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2021-02-08 04:58:49 +0100
committerMichael Forney <mforney@mforney.org>2021-02-08 04:58:49 +0100
commit415c110b284bdd519e6dedcfea97e45edcb8977a (patch)
tree927c32f113881845127ed52adddcd1206f52160a
parente502abe001306ad8c95ea5b32a437c53d90eccfa (diff)
downloadplan9front-415c110b284bdd519e6dedcfea97e45edcb8977a.tar.xz
games/gb: fix reversed audio channels
The high bits correspond to the left channel, and the low bits to the right channel. Reference: https://gbdev.io/pandocs/#sound-control-registers Tested with pokemon crystal.
-rw-r--r--sys/src/games/gb/apu.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/src/games/gb/apu.c b/sys/src/games/gb/apu.c
index 900f7e793..e0862ebdf 100644
--- a/sys/src/games/gb/apu.c
+++ b/sys/src/games/gb/apu.c
@@ -115,13 +115,13 @@ filter(int t)
if(i == 2 ? ((reg[NR30] & 0x80) == 0) : ((*sndch[i].env & 0xf8) == 0))
continue;
v = sndch[i].samp * 2 - 15;
- if((cnth & 1<<i) != 0)
- ov0 += v;
if((cnth & 1<<4<<i) != 0)
+ ov0 += v;
+ if((cnth & 1<<i) != 0)
ov1 += v;
}
- ov0 *= 1 + (cntl & 7);
- ov1 *= 1 + (cntl >> 4 & 7);
+ ov0 *= 1 + (cntl >> 4 & 7);
+ ov1 *= 1 + (cntl & 7);
}
static void