From 5cb6e1046b02eb657e73bd2f827ee8aecb5ea48e Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 29 Jun 2022 00:21:25 +0200 Subject: [PATCH] Fix automated controllable display value ::automation_run() evaluates the value, possibly ahead of time depending on latency-compensation. The actual value is set in realtime-context via set_value_unchecked() -> actually_set_value() which emits the Changed signal. At this point in time Control::user_value is already set correctly. There is no need to evaluate and interpolate again, at a potentially incorrect (uncompensated) time: `_session.transport_sample()`. This fixes an issue with the GUI Automation control showing an outdated value when there is an "immediate jump" in the signal: eg. add a latent plugin post-fader, then automate the Fader to jump from 0dB to -inf dB (snap to grid) and play though that transition. (Plugin controls were not affected by this bug, the process cycle is split for those, but Mixbus internal AC were affected). --- libs/ardour/automation_control.cc | 8 +++++--- libs/ardour/slavable_automation_control.cc | 14 ++++---------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/libs/ardour/automation_control.cc b/libs/ardour/automation_control.cc index 8c76b6fd2b..c13e475df3 100644 --- a/libs/ardour/automation_control.cc +++ b/libs/ardour/automation_control.cc @@ -95,12 +95,14 @@ AutomationControl::writable() const return true; } -/** Get the current effective `user' value based on automation state */ double AutomationControl::get_value() const { - bool from_list = alist() && alist()->automation_playback(); - return Control::get_double (from_list, timepos_t (_session.transport_sample())); + /* automation_run() will have updated the value + * (possibly ahead of time, according to latency compensation), + * and actually_set_value() will have set the user-value accordingly. + */ + return Control::user_double(); } double diff --git a/libs/ardour/slavable_automation_control.cc b/libs/ardour/slavable_automation_control.cc index 9caf59a16a..47d6d00005 100644 --- a/libs/ardour/slavable_automation_control.cc +++ b/libs/ardour/slavable_automation_control.cc @@ -106,18 +106,12 @@ SlavableAutomationControl::get_value_locked() const double SlavableAutomationControl::get_value() const { - bool from_list = _list && boost::dynamic_pointer_cast(_list)->automation_playback(); - 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, timepos_t (_session.transport_sample())) * get_masters_value_locked(); + 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 (); } bool