Prepare replacing ::user_double() with ::get_double()

Automation Controls (and controls in general) are now
only updated in realtime context. Either via automation-playback,
or via SessioEvent. This directly sets the Control:_user_value
(before emitting the Changed signal).

The GUI does not need to evaluate the control at a given point
in time, so the API call can be removed and unified.

This commit first removes all calls to "get_double" to ensure
that no special cases exist.
This commit is contained in:
Robin Gareus 2022-06-29 01:09:13 +02:00
parent 5cb6e1046b
commit a4a241c738
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
5 changed files with 8 additions and 23 deletions

View file

@ -109,7 +109,7 @@ double
AutomationControl::get_save_value() const
{
/* save user-value, not incl masters */
return Control::get_double ();
return Control::user_double ();
}
void

View file

@ -373,7 +373,7 @@ MidiTrack::update_controls (BufferSet const& bufs)
const Evoral::Parameter param = midi_parameter(ev.buffer(), ev.size());
const boost::shared_ptr<AutomationControl> control = automation_control (param);
if (control) {
double old = control->get_double ();
double old = control->user_double ();
control->set_double (ev.value(), timepos_t::zero (false), false);
if (old != ev.value()) {
control->Changed (false, Controllable::NoGroup);

View file

@ -86,7 +86,7 @@ SlavableAutomationControl::get_value_locked() const
/* read or write masters lock must be held */
if (_masters.empty()) {
return Control::get_double ();
return Control::user_double ();
}
if (_desc.toggled) {
@ -94,12 +94,12 @@ SlavableAutomationControl::get_value_locked() const
* enabled, this slave is enabled. So check our own value
* first, because if we are enabled, we can return immediately.
*/
if (Control::get_double ()) {
if (Control::user_double ()) {
return _desc.upper;
}
}
return Control::get_double () * get_masters_value_locked ();
return Control::user_double () * get_masters_value_locked ();
}
/** Get the current effective `user' value based on automation state */
@ -137,7 +137,7 @@ SlavableAutomationControl::masters_curve_multiply (timepos_t const & start, time
vec[i] *= scratch[i];
}
} else {
apply_gain_to_buffer (vec, veclen, Control::get_double ());
apply_gain_to_buffer (vec, veclen, Control::user_double ());
}
if (_masters.empty()) {
return rv;
@ -332,7 +332,7 @@ SlavableAutomationControl::remove_master (boost::shared_ptr<AutomationControl> m
pre_remove_master (m);
const double old_val = AutomationControl::get_double();
const double old_val = AutomationControl::user_double();
bool update_value = false;
double master_ratio = 0;
@ -400,7 +400,7 @@ SlavableAutomationControl::clear_masters ()
return;
}
const double old_val = AutomationControl::get_double();
const double old_val = AutomationControl::user_double ();
ControlList masters;
bool update_value = false;

View file

@ -37,20 +37,6 @@ Control::Control(const Parameter& parameter,
set_list (list);
}
/** Get the currently effective value (ie the one that corresponds to current output)
*/
double
Control::get_double (bool from_list, Temporal::timepos_t const & when) const
{
if (from_list) {
return _list->eval (when);
} else {
return _user_value;
}
}
void
Control::set_double (double value, Temporal::timepos_t const & when, bool to_list)
{

View file

@ -55,7 +55,6 @@ public:
virtual ~Control() {}
virtual void set_double (double val, Temporal::timepos_t const & when = Temporal::timepos_t (), bool to_list = false);
virtual double get_double (bool from_list = false, Temporal::timepos_t const & when = Temporal::timepos_t ()) const;
/** Get the latest user-set value
* (which may not equal get_value() when automation is playing back).