Consolidate rt processor-changed signal emission

Prefer a single signal and bit flags, instead of individual signals.
This allows to call resort_route() at most once (if at all for
certain changes).

Notably Mixbus comp/gate/eq type changes can use NoProcessorChange
to only request a GUI update.
This commit is contained in:
Robin Gareus 2025-08-12 18:56:24 +02:00
parent e734acfa6b
commit b14ce31372
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
3 changed files with 27 additions and 26 deletions

View file

@ -1055,6 +1055,10 @@ inline Route::PluginSetupOptions operator&= (Route::PluginSetupOptions& a, const
return a = static_cast<Route::PluginSetupOptions> (static_cast <int>(a) & static_cast<int> (b));
}
inline RouteProcessorChange::Type operator|= (RouteProcessorChange::Type& a, const RouteProcessorChange::Type& b) {
return a = static_cast<RouteProcessorChange::Type> (static_cast <int>(a) | static_cast<int> (b));
}
int
Route::add_processors (const ProcessorList& others, std::shared_ptr<Processor> before, ProcessorStreams* err)
{
@ -4231,20 +4235,20 @@ void
Route::emit_pending_signals ()
{
int sig = _pending_signals.fetch_and (0);
if (sig & EmitMeterChanged) {
_meter->emit_configuration_changed();
meter_change (); /* EMIT SIGNAL */
if (sig & EmitMeterVisibilityChange) {
processors_changed (RouteProcessorChange (RouteProcessorChange::MeterPointChange, true)); /* EMIT SIGNAL */
} else {
processors_changed (RouteProcessorChange (RouteProcessorChange::MeterPointChange, false)); /* EMIT SIGNAL */
if (sig != 0) {
bool meter_viz_changed = (sig & (EmitMeterVisibilityChange | EmitMeterChanged)) == (EmitMeterVisibilityChange | EmitMeterChanged);
RouteProcessorChange::Type t = RouteProcessorChange::NoProcessorChange;
if (sig & EmitRtProcessorChange) {
t |= RouteProcessorChange::RealTimeChange;
}
}
if (sig & EmitRtProcessorChange) {
processors_changed (RouteProcessorChange (RouteProcessorChange::RealTimeChange)); /* EMIT SIGNAL */
}
if (sig & EmitSendReturnChange) {
processors_changed (RouteProcessorChange (RouteProcessorChange::SendReturnChange, false)); /* EMIT SIGNAL */
if (sig & EmitSendReturnChange) {
t |= RouteProcessorChange::SendReturnChange;
}
if (sig & EmitMeterVisibilityChange) {
t |= RouteProcessorChange::MeterPointChange;
}
processors_changed (RouteProcessorChange (t, meter_viz_changed));
}
/* this would be a job for the butler.

View file

@ -8166,15 +8166,8 @@ Session::ProcessorChangeBlocker::~ProcessorChangeBlocker ()
if (PBD::atomic_dec_and_test (_session->_ignore_route_processor_changes)) {
RouteProcessorChange::Type type = (RouteProcessorChange::Type) _session->_ignored_a_processor_change.fetch_and (0);
if (_reconfigure_on_delete) {
if (type & RouteProcessorChange::GeneralChange) {
_session->route_processors_changed (RouteProcessorChange ());
} else {
if (type & RouteProcessorChange::MeterPointChange) {
_session->route_processors_changed (RouteProcessorChange (RouteProcessorChange::MeterPointChange));
}
if (type & RouteProcessorChange::RealTimeChange) {
_session->route_processors_changed (RouteProcessorChange (RouteProcessorChange::RealTimeChange));
}
if (type != RouteProcessorChange::NoProcessorChange) {
_session->route_processors_changed (type);
}
}
}

View file

@ -1963,21 +1963,25 @@ Session::route_processors_changed (RouteProcessorChange c)
return;
}
if (c.type == RouteProcessorChange::MeterPointChange) {
/* sort rec-armed routes first */
if (c.type == RouteProcessorChange::NoProcessorChange) {
return;
}
if (c.type & RouteProcessorChange::MeterPointChange) {
/* sort rec-armed routes to be processed first */
resort_routes ();
set_dirty ();
return;
}
if (c.type == RouteProcessorChange::RealTimeChange) {
if (c.type & RouteProcessorChange::RealTimeChange) {
set_dirty ();
return;
}
resort_routes ();
if (c.type == RouteProcessorChange::SendReturnChange) {
if (c.type & RouteProcessorChange::SendReturnChange) {
update_latency_compensation (true, false);
} else {
update_latency_compensation (false, false);