From c1f92861c6bbfc13c26f615b0566ac95a66f63df Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 27 May 2022 23:05:34 -0600 Subject: [PATCH] triggerbox: fix responses to "Play Cues" button being clicked Session handles the case when the button is used to enable cue triggering, by forcing a locate to the current transport position. TriggerBox now connects to the correct configuration object to notice when cue triggering is disabled, and sets _cancel_locate_armed appropriately. --- libs/ardour/session_state.cc | 6 ++++++ libs/ardour/triggerbox.cc | 18 +++--------------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index 54c4ad361f..b44b5f10a9 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -4415,6 +4415,12 @@ Session::config_changed (std::string p, bool ours) _master_out->set_volume_applies_to_output (true); master_volume ()->set_value (GAIN_COEFF_UNITY, Controllable::NoGroup); } + } else if (p == "cue-behavior") { + bool follow = (config.get_cue_behavior() & FollowCues); + std::cerr << "cue behavior changed, follow = " << follow << std::endl; + if (follow && !transport_state_rolling() && !loading()) { + request_locate (transport_sample(), true); + } } set_dirty (); diff --git a/libs/ardour/triggerbox.cc b/libs/ardour/triggerbox.cc index 578602136c..45ade94147 100644 --- a/libs/ardour/triggerbox.cc +++ b/libs/ardour/triggerbox.cc @@ -2900,6 +2900,7 @@ TriggerBox::TriggerBox (Session& s, DataType dt) } Config->ParameterChanged.connect_same_thread (*this, boost::bind (&TriggerBox::parameter_changed, this, _1)); + _session.config.ParameterChanged.connect_same_thread (*this, boost::bind (&TriggerBox::parameter_changed, this, _1)); } void @@ -2919,21 +2920,8 @@ TriggerBox::parameter_changed (std::string const & param) reconnect_to_default (); } else if (param == "cue-behavior") { - bool follow = (_session.config.get_cue_behavior() & FollowCues); - if (follow) { - - /* XXX this is all wrong. We have to do the - * fast_forward() call from something like the butler - * thread, as we do when a locate happens (and we are - * following cues). - * - * FIX ME. - */ - - if (!_session.transport_state_rolling()) { - fast_forward (_session.cue_events(), _session.transport_sample()); - } - } else { + const bool follow = (_session.config.get_cue_behavior() & FollowCues); + if (!follow) { cancel_locate_armed (); } }