summaryrefslogtreecommitdiff
path: root/libs/ardour/automation_control.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2017-07-25 20:15:12 +0200
committerRobin Gareus <robin@gareus.org>2017-07-25 20:15:12 +0200
commitbde3edf1c8f5075af5913eaea4dc81b199a17138 (patch)
tree9146508939cb026e1b4a74aebbe3e11e9d00051e /libs/ardour/automation_control.cc
parent9bfe404b4e9f5bc1bbe11b4ef6fd9778a362d04c (diff)
Make start_touch() truly idempotent
Also don't allow outsiders to call Controllable::set_touching()
Diffstat (limited to 'libs/ardour/automation_control.cc')
-rw-r--r--libs/ardour/automation_control.cc47
1 files changed, 23 insertions, 24 deletions
diff --git a/libs/ardour/automation_control.cc b/libs/ardour/automation_control.cc
index e9bc1aebe0..9b7628a7ad 100644
--- a/libs/ardour/automation_control.cc
+++ b/libs/ardour/automation_control.cc
@@ -266,42 +266,41 @@ AutomationControl::set_automation_state (AutoState as)
}
void
-AutomationControl::start_touch(double when)
+AutomationControl::start_touch (double when)
{
- if (!_list) {
+ if (!_list || touching ()) {
return;
}
- if (!touching()) {
- if (alist()->automation_state() == Touch) {
- /* subtle. aligns the user value with the playback and
- * use take actual value (incl masters).
- *
- * Touch + hold writes inverse curve of master-automation
- * using AutomationWatch::timer ()
- */
- AutomationControl::actually_set_value (get_value (), Controllable::NoGroup);
- alist()->start_touch (when);
- if (!_desc.toggled) {
- AutomationWatch::instance().add_automation_watch (shared_from_this());
- }
+ if (alist()->automation_state() == Touch) {
+ /* subtle. aligns the user value with the playback and
+ * use take actual value (incl masters).
+ *
+ * Touch + hold writes inverse curve of master-automation
+ * using AutomationWatch::timer ()
+ */
+ AutomationControl::actually_set_value (get_value (), Controllable::NoGroup);
+ alist()->start_touch (when);
+ if (!_desc.toggled) {
+ AutomationWatch::instance().add_automation_watch (shared_from_this());
}
set_touching (true);
}
}
void
-AutomationControl::stop_touch(double when)
+AutomationControl::stop_touch (double when)
{
- if (!_list) return;
- if (touching()) {
- set_touching (false);
+ if (!_list || !touching ()) {
+ return;
+ }
- if (alist()->automation_state() == Touch) {
- alist()->stop_touch (when);
- if (!_desc.toggled) {
- AutomationWatch::instance().remove_automation_watch (shared_from_this());
- }
+ set_touching (false);
+
+ if (alist()->automation_state() == Touch) {
+ alist()->stop_touch (when);
+ if (!_desc.toggled) {
+ AutomationWatch::instance().remove_automation_watch (shared_from_this());
}
}
}