From 75c92ecbd6657dd61fdf04ab3456aaaff82b7125 Mon Sep 17 00:00:00 2001 From: hselasky Date: Fri, 6 May 2011 11:05:05 +0000 Subject: [PATCH] Bugfix: Make pianola/OMNI mode the default. git-svn-id: svn://svn.code.sf.net/p/jack-keyboard/code/trunk@16 1fa2bf75-7d80-4145-9e94-f9b4e25a1cb2 --- NEWS | 1 + src/jack-keyboard.c | 15 +++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 28fd511..3be85f8 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,7 @@ User-visible changes between 2.5 and 2.6 include: - Bugfix: A key volume of zero means key off. + - Bugfix: Make pianola/OMNI mode the default. - Feature: Don't start jackd when starting jack-keyboard. User-visible changes between 2.4 and 2.5 include: diff --git a/src/jack-keyboard.c b/src/jack-keyboard.c index 85a85ba..6b8f151 100644 --- a/src/jack-keyboard.c +++ b/src/jack-keyboard.c @@ -199,26 +199,33 @@ process_received_message_async(gpointer evp) { int i; struct MidiMessage *ev = (struct MidiMessage *)evp; + int b0 = ev->data[0]; + int b1 = ev->data[1]; - if (ev->data[0] == MIDI_RESET || (ev->data[0] == MIDI_CONTROLLER && - (ev->data[1] == MIDI_ALL_NOTES_OFF || ev->data[1] == MIDI_ALL_SOUND_OFF))) { + /* Strip channel from channel messages */ + if (b0 >= 0x80 && b0 <= 0xEF) + b0 = b0 & 0xF0; + + if (b0 == MIDI_RESET || (b0 == MIDI_CONTROLLER && + (b1 == MIDI_ALL_NOTES_OFF || b1 == MIDI_ALL_SOUND_OFF))) { for (i = 0; i < NNOTES; i++) { piano_keyboard_set_note_off(keyboard, i); } } - if (ev->data[0] == MIDI_NOTE_ON) { + if (b0 == MIDI_NOTE_ON) { if (ev->data[2] == 0) piano_keyboard_set_note_off(keyboard, ev->data[1]); else piano_keyboard_set_note_on(keyboard, ev->data[1]); } - if (ev->data[0] == MIDI_NOTE_OFF) { + if (b0 == MIDI_NOTE_OFF) { piano_keyboard_set_note_off(keyboard, ev->data[1]); } + ev->data [0] = b0 | channel; queue_message(ev); return (FALSE);