Bug#625282: jack-keyboard: Pianola mode (MIDI-in) broken wrt channel numbers

Dan Muresan danmbox3 at yahoo.ro
Tue May 3 06:00:27 UTC 2011


Package: jack-keyboard
Version: 2.5-2
Severity: normal
Tags: patch

Per the manual page, jack-keyboard should pass through incoming MIDI 
messages but replace the channel number with its own. It only recognizes
incoming messages sent on MIDI channel 0 however, and does not rewrite
the channel at all.


-- System Information:
Debian Release: squeeze/sid
  APT prefers lucid-updates
  APT policy: (500, 'lucid-updates'), (500, 'lucid-security'), (500, 'lucid-proposed'), (500, 'lucid-backports'), (500, 'lucid')
Architecture: i386 (i686)

Kernel: Linux 2.6.31-11-rt (SMP w/2 CPU cores; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages jack-keyboard depends on:
ii  jackd  5danmppa1~lucid1                  JACK Audio Connection Kit (default
ii  libc6  2.11.1-0ubuntu7.8                 Embedded GNU C Library: Shared lib
ii  libgli 2.24.1-0ubuntu1                   The GLib library of C routines
ii  libgtk 2.20.1-0ubuntu2                   The GTK+ graphical user interface 
ii  libjac 1:0.120.1+svn4142-2               JACK Audio Connection Kit (librari
ii  liblas 0.6.0~rc2-1ubuntu2danmppa3~lucid1 LASH Audio Session Handler (LASH) 
ii  libx11 2:1.3.2-1ubuntu3                  X11 client-side library

Versions of packages jack-keyboard recommends:
ii  a2jmidid          6-0ubuntu2             daemon for exposing legacy ALSA MI
ii  qjackctl          0.3.7-4danmppa1~lucid1 User interface for controlling the

Versions of packages jack-keyboard suggests:
ii  ghoste 20100923-0ubuntu1danmppa2~lucid1  A graphical DSSI plugin host
ii  lashd  0.6.0~rc2-1ubuntu2danmppa3~lucid1 LASH Audio Session Handler (LASH) 
ii  whysyn 20090403-1ubuntu1                 DSSI Soft Synth Interface

-- no debconf information
-------------- next part --------------
>From 724fa8746dc00c32db9dfadfcfe9fa46fa6ed95e Mon Sep 17 00:00:00 2001
From: Dan A. Muresan <danmbox at gmail.com>
Date: Tue, 3 May 2011 01:12:17 +0300
Subject: [PATCH] Fix pianola mode (MIDI-in).

Per the manual page, jack-keyboard should pass through incoming MIDI
messages but replace the channel number with its own. The code only
recognized incoming messages sent on MIDI channel 0 however, and did
not rewrite the channel at all.
---
 src/jack-keyboard.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/jack-keyboard.c b/src/jack-keyboard.c
index 5f8bc7c..70c1027 100644
--- a/src/jack-keyboard.c
+++ b/src/jack-keyboard.c
@@ -199,23 +199,29 @@ process_received_message_async(gpointer evp)
 {
 	int		i;
 	struct MidiMessage *ev = (struct MidiMessage *)evp;
+	int b0 = ev->data [0], 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) {
 		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;
-- 
1.7.0.4



More information about the pkg-multimedia-maintainers mailing list