Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

softusb: ignore the CIN when classifying USB-MIDI messages

iCON don't always send a correct CIN value. Luckily, we can use the
first byte of the actual MIDI message instead.
  • Loading branch information...
commit 9ede4650fb6a15f09d81760b1dfb9d2984fe707d 1 parent b663a05
@wpwrak wpwrak authored sbourdeauducq committed
Showing with 10 additions and 1 deletion.
  1. +10 −1 softusb-input/main.c
View
11 softusb-input/main.c
@@ -486,8 +486,17 @@ static char process_midi(unsigned char *buf, unsigned char len)
unsigned char end = len & ~3;
unsigned char i, m, j;
+ /*
+ * In theory, control changes should be heralded by a CIN of 0xB,
+ * i.e., (buf[0] & 0x0f) == 0x0b.
+ * Faderfox and Korg do indeed work like this, but iCON choose to
+ * differ. Instead, they send everything with a CIN of 0x9, meaning
+ * "Note-on". To err on the compatible side, we thus simply ignore
+ * the CIN and only look at the first byte of the MIDI message.
+ */
+
for(i = 0; i != end; i += 4) {
- if((buf[i] & 0xf) != 0xb) /* not a control change */
+ if((buf[i+1] & 0xf0) != 0xb0) /* not a control change */
continue;
m = COMLOC_MIDI_PRODUCE;
for(j = 0; j != 4; j++)
Please sign in to comment.
Something went wrong with that request. Please try again.