From 8ad05fe5194fc2181d83f4f6effc40bde786cc57 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sun, 18 Jan 2026 12:52:15 -0700 Subject: [PATCH] update recording length selector/dropdown based on trigger capture duration --- gtk2_ardour/cue_editor.cc | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/gtk2_ardour/cue_editor.cc b/gtk2_ardour/cue_editor.cc index 1f5441ce6a..3b723878de 100644 --- a/gtk2_ardour/cue_editor.cc +++ b/gtk2_ardour/cue_editor.cc @@ -505,8 +505,8 @@ CueEditor::build_upper_toolbar () std::string noun; length_selector.add_menu_elem (MenuElem (_("Until Stopped"), sigc::bind (sigc::mem_fun (*this, &CueEditor::set_recording_length), Temporal::BBT_Offset ()))); - std::vector b ({ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 16, 20, 24, 32 }); - for (auto & n : b) { + const std::vector b ({ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 16, 20, 24, 32 }); + for (auto const & n : b) { noun = P_("Bar", "Bars", n); label = string_compose (X_("%1 %2"), n, noun); length_selector.add_menu_elem (MenuElem (label, sigc::bind (sigc::mem_fun (*this, &CueEditor::set_recording_length), Temporal::BBT_Offset (n, 0, 0)))); @@ -1316,6 +1316,21 @@ CueEditor::set_trigger (TriggerReference& tref) trigger->PropertyChanged.connect (trigger_connections, invalidator (*this), std::bind (&CueEditor::trigger_prop_change, this, _1), gui_context()); trigger->ArmChanged.connect (trigger_connections, invalidator (*this), std::bind (&CueEditor::trigger_arm_change, this), gui_context()); + BBT_Offset dur (trigger->capture_duration()); + if (dur != Temporal::BBT_Offset()) { + const std::vector b ({ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 16, 20, 24, 32 }); + int n = 1; + for (auto const & bars : b) { + if (dur.bars == bars) { + length_selector.set_active (n); + break; + } + ++n; + } + /* hmm, what do if not set ? */ + } else { + length_selector.set_active (0); /* "until stopped" */ + } if (trigger) { set_region (trigger->the_region());