shithub: riscv

Download patch

ref: 4c5e5174f82c67b0b2a15a08369a57ec0b03e916
parent: c1afd1158c54e93890168c7af3174ec1ac0914b8
author: qwx <qwx@sciops.net>
date: Sun Jan 15 15:32:09 EST 2023

games/dmid: add control 00h, bank select

akai mpk mini 2 and similar midi pianos: this is a nice
way to select opl3 banks 0-127 using a knob, while the
pads are mapped to percussions on channel 9

--- a/sys/src/games/dmid.c
+++ b/sys/src/games/dmid.c
@@ -413,13 +413,13 @@
 	case 0xb:
 		m = get8(x);
 		switch(n){
-		case 0x00: case 0x01: case 0x20: break;
+		case 0x00: if(m < Ninst) c->i = inst + m; break;
 		case 0x07: c->v = m; resetchan(c); break;
 		case 0x0a: c->pan = m < 32 ? 1<<4 : m > 96 ? 1<<5 : 3<<4; resetchan(c); break;
 		default: dprint("\nunknown controller %d", n);
 		}
 		break;
-	case 0xc: c->i = inst + n; break;
+	case 0xc: if(n < Ninst) c->i = inst + n; break;
 	case 0xe:
 		n = get8(x) << 7 | n;
 		c->bend = n - 0x4000 / 2;