a0990fc2a46c — Laurens Holst 4 years ago
OPLLTone: Make half the octave keys have fnum < 256 for key scaling.

The key scaling offset (0..15) is composed of the block number and fnum MSB.
Without this adjustment, the LSB of the key scaling offset would always be 1.
Comes at the cost of losing a bit of precision for half of the keys, but ’s ok.
1 files changed, 6 insertions(+), 0 deletions(-)

M src/modules/OPLLTone.asm
M src/modules/OPLLTone.asm +6 -0
@@ 72,6 72,12 @@ OPLLTone_GetFNumBlock: PROC
 	jp m,Continue
 	cp 8 << 3
 	jr nc,Clamp
+	bit 2,h
+	jr z,NoAdjust
+	cp 7 << 3
+	jr nc,NoAdjust
+	add a,1 << 3  ; make half the octave keys have fnum < 256 for key scaling
+NoAdjust:
 	ld c,a
 	ld a,h
 	sub c