summaryrefslogtreecommitdiff
path: root/libs/ardour/slavable_automation_control.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2017-06-13 18:09:22 +0200
committerRobin Gareus <robin@gareus.org>2017-06-13 18:09:59 +0200
commitc1912b6d516b69db67757687de38a115b3b6ab69 (patch)
treecf1e91a94e56d6973a4acffe2c930bf8db60ab64 /libs/ardour/slavable_automation_control.cc
parentb34d891b23e0268f50e171a2149f425987598902 (diff)
Write inverse master automation.
* The UI and ctrl-surface controls use and display the combined value, including control-masters. * The Automation lane of a control is the raw value of the control without masters. When touching (or writing) automation, the control-master needs to be factored out (or subtracted). e.g press+hold a control -> write inverse master automation.
Diffstat (limited to 'libs/ardour/slavable_automation_control.cc')
-rw-r--r--libs/ardour/slavable_automation_control.cc20
1 files changed, 14 insertions, 6 deletions
diff --git a/libs/ardour/slavable_automation_control.cc b/libs/ardour/slavable_automation_control.cc
index 4b1dc7721e..53808c862a 100644
--- a/libs/ardour/slavable_automation_control.cc
+++ b/libs/ardour/slavable_automation_control.cc
@@ -106,6 +106,10 @@ SlavableAutomationControl::get_value() const
Glib::Threads::RWLock::ReaderLock lm (master_lock);
if (!from_list) {
+ if (!_masters.empty() && automation_write ()) {
+ /* writing automation takes the fader value as-is, factor out the master */
+ return Control::user_double ();
+ }
return get_value_locked ();
} else {
return Control::get_double (true, _session.transport_frame()) * get_masters_value_locked();
@@ -153,14 +157,12 @@ SlavableAutomationControl::masters_curve_multiply (framepos_t start, framepos_t
return rv;
}
-void
-SlavableAutomationControl::actually_set_value (double value, PBD::Controllable::GroupControlDisposition gcd)
+double
+SlavableAutomationControl::reduce_by_masters_locked (double value, bool ignore_automation_state) const
{
if (!_desc.toggled) {
-
- Glib::Threads::RWLock::WriterLock lm (master_lock);
-
- if (!_masters.empty()) {
+ Glib::Threads::RWLock::ReaderLock lm (master_lock);
+ if (!_masters.empty() && (ignore_automation_state || !automation_write ())) {
/* need to scale given value by current master's scaling */
const double masters_value = get_masters_value_locked();
if (masters_value == 0.0) {
@@ -171,7 +173,13 @@ SlavableAutomationControl::actually_set_value (double value, PBD::Controllable::
}
}
}
+ return value;
+}
+void
+SlavableAutomationControl::actually_set_value (double value, PBD::Controllable::GroupControlDisposition gcd)
+{
+ value = reduce_by_masters (value);
/* this will call Control::set_double() and emit Changed signals as appropriate */
AutomationControl::actually_set_value (value, gcd);
}