summaryrefslogtreecommitdiff
path: root/libs/ardour/automation_control.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2016-03-09 10:26:09 -0500
committerPaul Davis <paul@linuxaudiosystems.com>2016-05-31 15:30:40 -0400
commit8eb45c518dd61594ca059c3751ca9de0f71ecb15 (patch)
tree37ccef2cbb6bd620aaebf7ebbcc91a5aced37a9b /libs/ardour/automation_control.cc
parent91f8c0be5424b615a33ef3e6e418ba3a1ace4613 (diff)
rearrange AutomationControl and RouteAutomationControl to get more shared logic and consistent master/slave behaviour
Diffstat (limited to 'libs/ardour/automation_control.cc')
-rw-r--r--libs/ardour/automation_control.cc37
1 files changed, 20 insertions, 17 deletions
diff --git a/libs/ardour/automation_control.cc b/libs/ardour/automation_control.cc
index 4317a18788..d7b645d8ae 100644
--- a/libs/ardour/automation_control.cc
+++ b/libs/ardour/automation_control.cc
@@ -69,18 +69,17 @@ AutomationControl::writable() const
return true;
}
-/** Get the current effective `user' value based on automation state */
double
-AutomationControl::get_value() const
+AutomationControl::get_masters_value_locked () const
{
- bool from_list = _list && ((AutomationList*)_list.get())->automation_playback();
+ gain_t v = 1.0;
- if (!from_list) {
- Glib::Threads::RWLock::ReaderLock lm (master_lock);
- return get_value_locked ();
- } else {
- return Control::get_double (from_list, _session.transport_frame());
+ for (Masters::const_iterator mr = _masters.begin(); mr != _masters.end(); ++mr) {
+ /* get current master value, scale by our current ratio with that master */
+ v *= mr->second.master()->get_value () * mr->second.ratio();
}
+
+ return min (_desc.upper, v);
}
double
@@ -92,17 +91,22 @@ AutomationControl::get_value_locked() const
return Control::get_double (false, _session.transport_frame());
}
- gain_t v = 1.0;
-
- for (Masters::const_iterator mr = _masters.begin(); mr != _masters.end(); ++mr) {
- /* get current master value, scale by our current ratio with that master */
- v *= mr->second.master()->get_value () * mr->second.ratio();
- }
-
- return min (_desc.upper, v);
+ return get_masters_value_locked ();
}
+/** Get the current effective `user' value based on automation state */
+double
+AutomationControl::get_value() const
+{
+ bool from_list = _list && ((AutomationList*)_list.get())->automation_playback();
+ if (!from_list) {
+ Glib::Threads::RWLock::ReaderLock lm (master_lock);
+ return get_value_locked ();
+ } else {
+ return Control::get_double (from_list, _session.transport_frame());
+ }
+}
/** Set the value and do the right thing based on automation state
* (e.g. record if necessary, etc.)
@@ -358,4 +362,3 @@ AutomationControl::slaved () const
Glib::Threads::RWLock::ReaderLock lm (master_lock);
return !_masters.empty();
}
-