From 8548626adffd0a9d4dd73c2f8e570372cb7eacda Mon Sep 17 00:00:00 2001 From: Ben Loftis Date: Fri, 7 Jan 2022 08:51:18 -0600 Subject: [PATCH] triggerbox: Add n-bar quantizations (GUI part) --- gtk2_ardour/cuebox_ui.cc | 6 ++++-- gtk2_ardour/slot_properties_box.cc | 3 ++- gtk2_ardour/trigger_master.cc | 12 ++++++++---- gtk2_ardour/trigger_ui.cc | 15 ++++++++++++--- 4 files changed, 26 insertions(+), 10 deletions(-) diff --git a/gtk2_ardour/cuebox_ui.cc b/gtk2_ardour/cuebox_ui.cc index c3a0ab637c..069e63ba62 100644 --- a/gtk2_ardour/cuebox_ui.cc +++ b/gtk2_ardour/cuebox_ui.cc @@ -296,10 +296,12 @@ CueBoxUI::context_menu (uint64_t idx) BBT_Offset b; + b = BBT_Offset (4, 0, 0); + qitems.push_back (MenuElem (_("4 Bars"), sigc::bind (sigc::mem_fun (*this, &CueBoxUI::set_all_quantization), b, idx))); + b = BBT_Offset (2, 0, 0); + qitems.push_back (MenuElem (_("2 Bars"), sigc::bind (sigc::mem_fun (*this, &CueBoxUI::set_all_quantization), b, idx))); b = BBT_Offset (1, 0, 0); qitems.push_back (MenuElem (_("1 Bar"), sigc::bind (sigc::mem_fun (*this, &CueBoxUI::set_all_quantization), b, idx))); - b = BBT_Offset (0, 4, 0); - qitems.push_back (MenuElem (_("Whole"), sigc::bind (sigc::mem_fun (*this, &CueBoxUI::set_all_quantization), b, idx))); b = BBT_Offset (0, 2, 0); qitems.push_back (MenuElem (_("1/2"), sigc::bind (sigc::mem_fun (*this, &CueBoxUI::set_all_quantization), b, idx))); b = BBT_Offset (0, 1, 0); diff --git a/gtk2_ardour/slot_properties_box.cc b/gtk2_ardour/slot_properties_box.cc index 20e6abc7b1..25d2cbc68a 100644 --- a/gtk2_ardour/slot_properties_box.cc +++ b/gtk2_ardour/slot_properties_box.cc @@ -179,8 +179,9 @@ SlotPropertyTable::SlotPropertyTable () #if TRIGGER_PAGE_GLOBAL_QUANTIZATION_IMPLEMENTED quantize_item (BBT_Offset (0, 0, 0)); #endif + quantize_item (BBT_Offset (4, 0, 0)); + quantize_item (BBT_Offset (2, 0, 0)); quantize_item (BBT_Offset (1, 0, 0)); - quantize_item (BBT_Offset (0, 4, 0)); quantize_item (BBT_Offset (0, 2, 0)); quantize_item (BBT_Offset (0, 1, 0)); quantize_item (BBT_Offset (0, 0, Temporal::ticks_per_beat/2)); diff --git a/gtk2_ardour/trigger_master.cc b/gtk2_ardour/trigger_master.cc index c306b067b0..cb06a3b6a5 100644 --- a/gtk2_ardour/trigger_master.cc +++ b/gtk2_ardour/trigger_master.cc @@ -373,9 +373,11 @@ TriggerMaster::context_menu () BBT_Offset b; - b = BBT_Offset (1, 0, 0); + b = BBT_Offset (4, 0, 0); qitems.push_back (MenuElem (TriggerUI::quantize_length_to_string (b), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_quantization), b))); - b = BBT_Offset (0, 4, 0); + b = BBT_Offset (2, 0, 0); + qitems.push_back (MenuElem (TriggerUI::quantize_length_to_string (b), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_quantization), b))); + b = BBT_Offset (1, 0, 0); qitems.push_back (MenuElem (TriggerUI::quantize_length_to_string (b), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_quantization), b))); b = BBT_Offset (0, 2, 0); qitems.push_back (MenuElem (TriggerUI::quantize_length_to_string (b), sigc::bind (sigc::mem_fun (*this, &TriggerMaster::set_all_quantization), b))); @@ -772,9 +774,11 @@ CueMaster::context_menu () BBT_Offset b; - b = BBT_Offset (1, 0, 0); + b = BBT_Offset (4, 0, 0); qitems.push_back (MenuElem (TriggerUI::quantize_length_to_string (b), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_quantization), b))); - b = BBT_Offset (0, 4, 0); + b = BBT_Offset (2, 0, 0); + qitems.push_back (MenuElem (TriggerUI::quantize_length_to_string (b), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_quantization), b))); + b = BBT_Offset (1, 0, 0); qitems.push_back (MenuElem (TriggerUI::quantize_length_to_string (b), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_quantization), b))); b = BBT_Offset (0, 2, 0); qitems.push_back (MenuElem (TriggerUI::quantize_length_to_string (b), sigc::bind (sigc::mem_fun (*this, &CueMaster::set_all_quantization), b))); diff --git a/gtk2_ardour/trigger_ui.cc b/gtk2_ardour/trigger_ui.cc index 2b87bfdf9e..fd7ce9636e 100644 --- a/gtk2_ardour/trigger_ui.cc +++ b/gtk2_ardour/trigger_ui.cc @@ -493,12 +493,17 @@ TriggerUI::launch_context_menu () } #endif - b = BBT_Offset (1, 0, 0); + b = BBT_Offset (4, 0, 0); qitems.push_back (RadioMenuElem (qgroup, TriggerUI::quantize_length_to_string (b), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_quantization), b))); if (trigger ()->quantization () == b) { dynamic_cast (&qitems.back ())->set_active (true); } - b = BBT_Offset (0, 4, 0); + b = BBT_Offset (2, 0, 0); + qitems.push_back (RadioMenuElem (qgroup, TriggerUI::quantize_length_to_string (b), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_quantization), b))); + if (trigger ()->quantization () == b) { + dynamic_cast (&qitems.back ())->set_active (true); + } + b = BBT_Offset (1, 0, 0); qitems.push_back (RadioMenuElem (qgroup, TriggerUI::quantize_length_to_string (b), sigc::bind(sigc::mem_fun (*this, &TriggerUI::set_quantization), b))); if (trigger ()->quantization () == b) { dynamic_cast (&qitems.back ())->set_active (true); @@ -728,7 +733,11 @@ TriggerUI::quantize_length_to_string (BBT_Offset const & ql) return _("None"); } - if (ql == BBT_Offset (1, 0, 0)) { + if (ql == BBT_Offset (4, 0, 0)) { + return _("4 Bars"); + } else if (ql == BBT_Offset (2, 0, 0)) { + return _("2 Bars"); + } else if (ql == BBT_Offset (1, 0, 0)) { return _("1 Bar"); } else if (ql == BBT_Offset (0, 1, 0)) { return _("1/4");