From 5248e81f9dae8bcd388b09ef1c67ee00ef5e442d Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 20 Dec 2024 10:44:35 -0700 Subject: [PATCH] start using visible channel in MIDI cue editor --- gtk2_ardour/editing_context.cc | 2 +- gtk2_ardour/midi_cue_editor.cc | 9 ++++++--- gtk2_ardour/midi_cue_editor.h | 1 + 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/gtk2_ardour/editing_context.cc b/gtk2_ardour/editing_context.cc index 6ab109c06f..57007473a3 100644 --- a/gtk2_ardour/editing_context.cc +++ b/gtk2_ardour/editing_context.cc @@ -208,7 +208,7 @@ EditingContext::EditingContext (std::string const & name) for (int i = 0; i < 16; i++) { char buf[4]; sprintf(buf, "%d", i+1); - visible_channel_selector.AddMenuElem (MenuElem (buf, [this,i]() { EditingContext::set_visible_channel (i); })); + visible_channel_selector.AddMenuElem (MenuElem (buf, [this,i]() { set_visible_channel (i); })); } /* handle escape */ diff --git a/gtk2_ardour/midi_cue_editor.cc b/gtk2_ardour/midi_cue_editor.cc index 7329b1a976..7be2b57121 100644 --- a/gtk2_ardour/midi_cue_editor.cc +++ b/gtk2_ardour/midi_cue_editor.cc @@ -254,6 +254,8 @@ MidiCueEditor::build_upper_toolbar () void MidiCueEditor::set_visible_channel (int n) { + _visible_channel = n; + visible_channel_label.set_text (string_compose (_("MIDI Channel %1"), _visible_channel + 1)); } void @@ -1901,6 +1903,8 @@ MidiCueEditor::set_region (std::shared_ptr r) samplecnt_t spp = floor (samples / width); reset_zoom (spp); } + + set_visible_channel (0); } bool @@ -1915,7 +1919,7 @@ MidiCueEditor::automation_button_event (GdkEventButton* ev, Evoral::ParameterTyp switch (ev->type) { case GDK_BUTTON_RELEASE: if (view) { - Evoral::Parameter param (type, 0, id); + Evoral::Parameter param (type, _visible_channel, id); if (view->is_visible_automation (param) && (op == SelectionSet)) { op = SelectionToggle; @@ -1934,13 +1938,12 @@ MidiCueEditor::automation_button_event (GdkEventButton* ev, Evoral::ParameterTyp void MidiCueEditor::automation_led_click (GdkEventButton* ev, Evoral::ParameterType type, int id) { -#warning paul allow channel selection (2nd param) if (ev->button != 1) { return; } if (view) { - view->set_active_automation (Evoral::Parameter (type, 0, id)); + view->set_active_automation (Evoral::Parameter (type, _visible_channel, id)); } } diff --git a/gtk2_ardour/midi_cue_editor.h b/gtk2_ardour/midi_cue_editor.h index 962fec7935..6a00d85cea 100644 --- a/gtk2_ardour/midi_cue_editor.h +++ b/gtk2_ardour/midi_cue_editor.h @@ -261,6 +261,7 @@ class MidiCueEditor : public CueEditor sigc::signal NoteModeChanged; void automation_state_changed (); + };