summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2010-06-29 13:20:09 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2010-06-29 13:20:09 +0000
commit7eb91510aa45676360a783355d30338d2cae9586 (patch)
tree5839a745cbb3fcdf892eec5404d628e99af3b1f9
parenta3cb425ca957bad3d4862ac38b111e71f7bcb318 (diff)
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
-rw-r--r--gtk2_ardour/midi_region_view.cc25
1 files 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<NoteType> 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<<i)) {
+ channel = i;
+ chn_cnt++;
+ }
+ }
+
+ if (chn_cnt == 16) {
+ channel = 0;
+ }
+
+ const boost::shared_ptr<NoteType> new_note (new NoteType (channel,
+ frames_to_beats(start_frames + _region->start()), length,
+ (uint8_t)note, 0x40));
if (_model->contains (new_note)) {
return;