From c16b7b6dd535a628161e3d109d7ce40b5618d1af Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 9 Jun 2022 02:19:36 +0200 Subject: [PATCH] MixerScene: only request actual value changes This is otherwise only caught later in the rt-thread after scheduling a RealTimeOperation via AutomationControl::check_rt. There is no need to schedule cross-thread events when the value is not about to be changed. This can greatly reduce the number of signals emitted by restoring a slot, which improves performance and also prevents the EventPool from filling up with useless events. --- libs/ardour/mixer_scene.cc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/libs/ardour/mixer_scene.cc b/libs/ardour/mixer_scene.cc index 9f01b3567d..f31f4578f1 100644 --- a/libs/ardour/mixer_scene.cc +++ b/libs/ardour/mixer_scene.cc @@ -105,14 +105,19 @@ MixerScene::recurse_to_master (boost::shared_ptr c, std::set return false; } + double old_value = ac ? ac->user_double () : c->get_value (); + if (sc && sc->slaved ()) { double x = sc->reduce_by_masters (1.0); - if (x <= 0) { - c->set_value (0, Controllable::NoGroup); + if (x == 0) { + x = 0; } else { - c->set_value (it->second / x, Controllable::NoGroup); + x = it->second / x; } - } else { + if (x != old_value) { + c->set_value (x, Controllable::NoGroup); + } + } else if (it->second != old_value) { c->set_value (it->second, Controllable::NoGroup); }