From 06ca52d5a5c405a5cb2b3f2d827edc60712412e9 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 15 Jul 2017 20:52:50 +0200 Subject: Add API to run automation only (emit Changed signal). Note: MuteControl already implemented this, This removes the special case of boolean_automation_run(). Likewise this removes special-cases for actually_set_value() during automation playback. --- libs/ardour/slavable_automation_control.cc | 33 +++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 10 deletions(-) (limited to 'libs/ardour/slavable_automation_control.cc') diff --git a/libs/ardour/slavable_automation_control.cc b/libs/ardour/slavable_automation_control.cc index 3128543dde..3285518522 100644 --- a/libs/ardour/slavable_automation_control.cc +++ b/libs/ardour/slavable_automation_control.cc @@ -290,11 +290,7 @@ SlavableAutomationControl::master_changed (bool /*from_self*/, GroupControlDispo { boost::shared_ptr m = wm.lock (); assert (m); - Glib::Threads::RWLock::ReaderLock lm (master_lock, Glib::Threads::TRY_LOCK); - if (!lm.locked ()) { - /* boolean_automation_run_locked () special case */ - return; - } + Glib::Threads::RWLock::ReaderLock lm (master_lock); bool send_signal = handle_master_change (m); lm.release (); // update_boolean_masters_records() takes lock @@ -521,6 +517,28 @@ SlavableAutomationControl::handle_master_change (boost::shared_ptrrt_safe_eval (start, valid); + if (!valid) { + return; + } + if (toggled ()) { + const double thresh = .5 * (_desc.upper - _desc.lower); + bool on = (val >= thresh) || (get_masters_value () >= thresh); + set_value_unchecked (on ? _desc.upper : _desc.lower); + } else { + set_value_unchecked (val * get_masters_value ()); + } +} + bool SlavableAutomationControl::boolean_automation_run_locked (framepos_t start, pframes_t len) { @@ -551,11 +569,6 @@ SlavableAutomationControl::boolean_automation_run_locked (framepos_t start, pfra if (mr->second.yn() != yn) { rv |= handle_master_change (ac); mr->second.set_yn (yn); - /* notify the GUI, without recursion: - * master_changed() above will ignore the change if the lock is held. - */ - ac->set_value_unchecked (yn ? 1. : 0.); - ac->Changed (false, Controllable::NoGroup); /* EMIT SIGNAL */ } } return rv; -- cgit v1.2.3