Add preference to limit concurrent RTA

This prevents accidentally analyzing hundreds of tracks,
making the machine grind to a halt.
This commit is contained in:
Robin Gareus 2025-10-15 01:42:41 +02:00
parent 360d069928
commit d158e5371d
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
4 changed files with 51 additions and 0 deletions

View file

@ -4869,6 +4869,23 @@ These settings will only take effect after %1 is restarted.\n\
sigc::mem_fun (*_rc_config, &RCConfiguration::set_auto_analyse_audio)
));
add_option (S_("Preferences|Metering"), new OptionEditorHeading (_("Realtime Analyzer")));
ComboOption<uint32_t>* rta = new ComboOption<uint32_t> (
"max-active-rta",
_("Limit concurrent RTA specta"),
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_max_active_rta),
sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_max_active_rta)
);
rta->add ( 4, _("4"));
rta->add ( 8, _("8"));
rta->add (12, _("12"));
rta->add (16, _("16 (fast CPUs)"));
rta->add (16, _("20 (very fast CPUs)"));
rta->add ( 0, _("No Limt"));
add_option (S_("Preferences|Metering"), rta);
/* PERFORMANCE **************************************************************/

View file

@ -52,6 +52,7 @@ RTAManager::RTAManager ()
, _warp (ARDOUR::DSP::PerceptualAnalyzer::Medium)
, _clearing (false)
{
UIConfiguration::instance().ParameterChanged.connect (sigc::mem_fun (*this, &RTAManager::parameter_changed));
}
RTAManager::~RTAManager ()
@ -119,6 +120,14 @@ RTAManager::session_going_away ()
_session = 0;
}
void
RTAManager::parameter_changed (std::string p)
{
if (p == "max-active-rta") {
limit_active_rta ();
}
}
void
RTAManager::set_active (bool en)
{
@ -164,6 +173,25 @@ RTAManager::set_rta_warp (DSP::PerceptualAnalyzer::Warp w)
SettingsChanged (); /* EMIT SIGNAL */
}
void
RTAManager::limit_active_rta ()
{
uint32_t max_rta = UIConfiguration::instance().get_max_active_rta ();
if (max_rta > 1 && _rta.size () >= max_rta) {
#if 0
remove (_rta.back ().route ());
#else
for (auto const& r : _rta) {
if (r.route()->is_master ()) {
continue;
}
remove (r.route ());
break;
}
#endif
}
}
void
RTAManager::attach (std::shared_ptr<ARDOUR::Route> route)
{
@ -172,6 +200,9 @@ RTAManager::attach (std::shared_ptr<ARDOUR::Route> route)
return;
}
}
limit_active_rta ();
std::list<RTA>::iterator i;
try {
/* render master first (as background) because it is the sum of other individual channels */

View file

@ -115,6 +115,8 @@ private:
void run_rta ();
void session_going_away ();
void route_removed (std::weak_ptr<ARDOUR::Route>);
void limit_active_rta ();
void parameter_changed (std::string);
std::list<RTA> _rta;
bool _active;

View file

@ -121,6 +121,7 @@ UI_CONFIG_VARIABLE (ARDOUR::PluginGUIBehavior, plugin_gui_behavior, "plugin-gui-
UI_CONFIG_VARIABLE (bool, show_inline_display_by_default, "show-inline-display-by-default", true)
UI_CONFIG_VARIABLE (int32_t, max_plugin_chart, "max-plugin-chart", 10)
UI_CONFIG_VARIABLE (int32_t, max_plugin_recent, "max-plugin-recent", 10)
UI_CONFIG_VARIABLE (uint32_t, max_active_rta, "max-active-rta", 8)
UI_CONFIG_VARIABLE (bool, prefer_inline_over_gui, "prefer-inline-over-gui", true)
UI_CONFIG_VARIABLE (uint32_t, max_inline_controls, "max-inline-controls", 32) /* per processor */
UI_CONFIG_VARIABLE (uint32_t, action_table_columns, "action-table-columns", 3)