summaryrefslogtreecommitdiff
path: root/libs/ardour/slavable_automation_control.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2017-07-15 20:52:50 +0200
committerRobin Gareus <robin@gareus.org>2017-07-16 16:52:12 +0200
commit06ca52d5a5c405a5cb2b3f2d827edc60712412e9 (patch)
tree4fd2417f75f49743624fb3caa6f9672fc999b769 /libs/ardour/slavable_automation_control.cc
parent906cf85982c209caebed3053c3a33d77ca6ddee0 (diff)
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.
Diffstat (limited to 'libs/ardour/slavable_automation_control.cc')
-rw-r--r--libs/ardour/slavable_automation_control.cc33
1 files changed, 23 insertions, 10 deletions
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<AutomationControl> 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_ptr<AutomationCon
return true; // emit Changed
}
+void
+SlavableAutomationControl::automation_run (framepos_t start, pframes_t nframes)
+{
+ if (!automation_playback ()) {
+ return;
+ }
+
+ assert (_list);
+ bool valid = false;
+ double val = _list->rt_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;