9front - general discussion about 9front
 help / color / mirror / Atom feed
* [9front] games/gb: fix reversed audio channels
@ 2021-02-08  0:12 Michael Forney
  2021-02-08  4:02 ` qwx
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Forney @ 2021-02-08  0:12 UTC (permalink / raw)
  To: 9front

The high bits correspond to the left channel, and the low bits to the
right channel.

Reference: https://gbdev.io/pandocs/#sound-control-registers

diff 3fc115a6ff6eef65210fb78a51128958d2b55910 9d0249f7a978b4e84f3cd9083f787b4f3f533b41
--- a/sys/src/games/gb/apu.c	Sun Feb  7 15:22:39 2021
+++ b/sys/src/games/gb/apu.c	Sun Feb  7 16:12:28 2021
@@ -115,13 +115,13 @@
 		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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-02-08  8:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-08  0:12 [9front] games/gb: fix reversed audio channels Michael Forney
2021-02-08  4:02 ` qwx

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).