From f3630a571925845e20fc469698c291cf3c55ed31 Mon Sep 17 00:00:00 2001 From: EvanR Date: Wed, 10 Dec 2008 23:15:00 -0600 Subject: [PATCH] Fixed note-stuck-on-channel-change bug. Also the note-stuck-on-port-change bug. Note was sticking if you change chan or port while the note is playing. I added a convenience function to backend.h which allowed muting a particular channel rather than a track. --- src/backend.h | 1 + src/jack.cpp | 4 ++++ src/trackmodule.cpp | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/src/backend.h b/src/backend.h index 29552f1..1a3006d 100644 --- a/src/backend.h +++ b/src/backend.h @@ -57,6 +57,7 @@ void all_notes_off(); void program_change(int track, int prog); void midi_note_off(int note, int chan, int port); +void midi_channel_off(int chan, int port); void midi_track_off(int track); #endif diff --git a/src/jack.cpp b/src/jack.cpp index 41b4c9d..d1ad9a0 100644 --- a/src/jack.cpp +++ b/src/jack.cpp @@ -389,6 +389,10 @@ void midi_track_off(int track){ int chan = tracks[track]->chan; int port = tracks[track]->port; + midi_channel_off(chan,port); +} + +void midi_channel_off(int chan, int port){ char buf[3] = {0xB0,123,0}; buf[0] = 0xB0 | chan; send_midi(buf,3,port); diff --git a/src/trackmodule.cpp b/src/trackmodule.cpp index eb2b183..55ec38d 100644 --- a/src/trackmodule.cpp +++ b/src/trackmodule.cpp @@ -39,13 +39,17 @@ extern UI* ui; void portcb(fltk::Widget* w, long i){ fltk::ValueInput* o = (fltk::ValueInput*)w; track* t = tracks[i]; + int old_port = t->port; t->port = (int)o->value(); + midi_channel_off(t->chan,old_port); } void chancb(fltk::Widget* w, long i){ fltk::ValueInput* o = (fltk::ValueInput*)w; track* t = tracks[i]; + int old_chan = t->chan; t->chan = (int)o->value(); + midi_channel_off(old_chan,t->port); } void progcb(fltk::Widget* w, long i){ -- 2.11.4.GIT