From 7eb91510aa45676360a783355d30338d2cae9586 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Tue, 29 Jun 2010 13:20:09 +0000 Subject: pay attention to MIDI channel selector when creating notes with GUI (fixes #3233) git-svn-id: svn://localhost/ardour2/branches/3.0@7321 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/midi_region_view.cc | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc index 6c30709767..e1bf3c1f22 100644 --- a/gtk2_ardour/midi_region_view.cc +++ b/gtk2_ardour/midi_region_view.cc @@ -674,9 +674,28 @@ MidiRegionView::create_note_at(double x, double y, double length, bool sh) length = frames_to_beats (beats_to_frames (length) - 1); } - const boost::shared_ptr new_note(new NoteType(0, - frames_to_beats(start_frames + _region->start()), length, - (uint8_t)note, 0x40)); + uint16_t chn_mask = mtv->channel_selector().get_selected_channels(); + int chn_cnt = 0; + uint8_t channel = 0; + + /* pick the highest selected channel, unless all channels are selected, + which is interpreted to mean channel 1 (zero) + */ + + for (uint16_t i = 0; i < 16; ++i) { + if (chn_mask & (1< new_note (new NoteType (channel, + frames_to_beats(start_frames + _region->start()), length, + (uint8_t)note, 0x40)); if (_model->contains (new_note)) { return; -- cgit v1.2.3