diff options
Diffstat (limited to 'libs/ardour/automation_control.cc')
-rw-r--r-- | libs/ardour/automation_control.cc | 37 |
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(); } - |