From 58d192ba4d8d3f51ec1a31600c3388239e9bf124 Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Mon, 13 Feb 2012 20:43:44 -0300 Subject: [PATCH] midi2osc: fix translation of Note On and Pitch; add debug output --- midi2osc/midi2osc.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/midi2osc/midi2osc.c b/midi2osc/midi2osc.c index ffc82de..6b0f5e2 100644 --- a/midi2osc/midi2osc.c +++ b/midi2osc/midi2osc.c @@ -100,7 +100,12 @@ static void forward(snd_seq_t *midi, lo_address osc) while (snd_seq_event_input(midi, &ev)) { switch (ev->type) { case SND_SEQ_EVENT_NOTEON: - msg[1] = 0x90 | ev->data.control.channel; + if (debug) + fprintf(stderr, "note c%u.%u=%u\n", + ev->data.note.channel, + ev->data.note.note, + ev->data.note.velocity); + msg[1] = 0x90 | ev->data.note.channel; msg[2] = ev->data.note.note; msg[3] = ev->data.note.velocity; break; @@ -110,7 +115,8 @@ static void forward(snd_seq_t *midi, lo_address osc) value = ev->data.control.value; map(&chan, &ctrl, &value); if (debug) - fprintf(stderr, "c%u.%u=%u -> c%u.%u=%u\n", + fprintf(stderr, + "control c%u.%u=%u -> c%u.%u=%u\n", ev->data.control.channel, ev->data.control.param, ev->data.control.value, @@ -120,9 +126,13 @@ static void forward(snd_seq_t *midi, lo_address osc) msg[3] = value; break; case SND_SEQ_EVENT_PITCHBEND: + if (debug) + fprintf(stderr, "pitch c%u=%u\n", + ev->data.control.channel, + ev->data.control.value); msg[1] = 0xe0 | ev->data.control.channel; - msg[2] = ev->data.control.value; - msg[3] = 0; + msg[2] = ev->data.control.value & 0x7f; + msg[3] = ev->data.control.value >> 7; break; default: /* Flickernoise currently doesn't support any others */