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)); 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 int
Route::add_processors (const ProcessorList& others, std::shared_ptr<Processor> before, ProcessorStreams* err) Route::add_processors (const ProcessorList& others, std::shared_ptr<Processor> before, ProcessorStreams* err)
{ {
@ -4231,20 +4235,20 @@ void
Route::emit_pending_signals () Route::emit_pending_signals ()
{ {
int sig = _pending_signals.fetch_and (0); int sig = _pending_signals.fetch_and (0);
if (sig & EmitMeterChanged) {
_meter->emit_configuration_changed(); if (sig != 0) {
meter_change (); /* EMIT SIGNAL */ bool meter_viz_changed = (sig & (EmitMeterVisibilityChange | EmitMeterChanged)) == (EmitMeterVisibilityChange | EmitMeterChanged);
if (sig & EmitMeterVisibilityChange) { RouteProcessorChange::Type t = RouteProcessorChange::NoProcessorChange;
processors_changed (RouteProcessorChange (RouteProcessorChange::MeterPointChange, true)); /* EMIT SIGNAL */ if (sig & EmitRtProcessorChange) {
} else { t |= RouteProcessorChange::RealTimeChange;
processors_changed (RouteProcessorChange (RouteProcessorChange::MeterPointChange, false)); /* EMIT SIGNAL */
} }
} if (sig & EmitSendReturnChange) {
if (sig & EmitRtProcessorChange) { t |= RouteProcessorChange::SendReturnChange;
processors_changed (RouteProcessorChange (RouteProcessorChange::RealTimeChange)); /* EMIT SIGNAL */ }
} if (sig & EmitMeterVisibilityChange) {
if (sig & EmitSendReturnChange) { t |= RouteProcessorChange::MeterPointChange;
processors_changed (RouteProcessorChange (RouteProcessorChange::SendReturnChange, false)); /* EMIT SIGNAL */ }
processors_changed (RouteProcessorChange (t, meter_viz_changed));
} }
/* this would be a job for the butler. /* 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)) { if (PBD::atomic_dec_and_test (_session->_ignore_route_processor_changes)) {
RouteProcessorChange::Type type = (RouteProcessorChange::Type) _session->_ignored_a_processor_change.fetch_and (0); RouteProcessorChange::Type type = (RouteProcessorChange::Type) _session->_ignored_a_processor_change.fetch_and (0);
if (_reconfigure_on_delete) { if (_reconfigure_on_delete) {
if (type & RouteProcessorChange::GeneralChange) { if (type != RouteProcessorChange::NoProcessorChange) {
_session->route_processors_changed (RouteProcessorChange ()); _session->route_processors_changed (type);
} else {
if (type & RouteProcessorChange::MeterPointChange) {
_session->route_processors_changed (RouteProcessorChange (RouteProcessorChange::MeterPointChange));
}
if (type & RouteProcessorChange::RealTimeChange) {
_session->route_processors_changed (RouteProcessorChange (RouteProcessorChange::RealTimeChange));
}
} }
} }
} }

View file

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