diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2011-12-14 17:17:30 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2011-12-14 17:17:30 +0000 |
commit | 96585e532c879220057edd050806c823ed6e4c1d (patch) | |
tree | f476498ed64726e8196167cd278e35803da91ab0 /libs/ardour/midi_track.cc | |
parent | 60872a8504cccc0d7e6c2485af8c0362577f5723 (diff) |
send sustain=off and all-notes-off when a MIDI track is muted (may fix #4295)
git-svn-id: svn://localhost/ardour2/branches/3.0@11005 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/midi_track.cc')
-rw-r--r-- | libs/ardour/midi_track.cc | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/libs/ardour/midi_track.cc b/libs/ardour/midi_track.cc index 3033f3d952..e835008e67 100644 --- a/libs/ardour/midi_track.cc +++ b/libs/ardour/midi_track.cc @@ -715,3 +715,33 @@ MidiTrack::get_gui_feed_buffer () const { return midi_diskstream()->get_gui_feed_buffer (); } + +void +MidiTrack::act_on_mute () +{ + /* this is called right after our mute status has changed. + if we are now muted, send suitable output to shutdown + all our notes. + + XXX we should should also stop all relevant note trackers. + */ + + if (muted()) { + /* only send messages for channels we are using */ + + uint16_t mask = get_channel_mask(); + + for (uint8_t channel = 0; channel <= 0xF; channel++) { + + if ((1<<channel) & mask) { + + DEBUG_TRACE (DEBUG::MidiIO, string_compose ("%1 delivers mute message to channel %2\n", name(), channel+1)); + uint8_t ev[3] = { MIDI_CMD_CONTROL | channel, MIDI_CTL_SUSTAIN, 0 }; + write_immediate_event (3, ev); + ev[1] = MIDI_CTL_ALL_NOTES_OFF; + write_immediate_event (3, ev); + } + } + } +} + |