Add option to limit automatable control parmaters
authorRobin Gareus <robin@gareus.org>
Wed, 31 Oct 2018 22:32:16 +0000 (23:32 +0100)
committerRobin Gareus <robin@gareus.org>
Wed, 31 Oct 2018 22:44:04 +0000 (23:44 +0100)
VCVRack VST currently exposes 9999 automatable-control parmaters.
This slows down various GUI dropdown lists and dialogs.
(even worse: those parameters are not mapped to anything by default).

This change allows to limit automatable parameters to a reasonable number,
without loosing state of already automated parameters in existing sessions.

libs/ardour/ardour/rc_configuration_vars.h
libs/ardour/automatable.cc
libs/ardour/plugin_insert.cc

index 452a0822cc7cea54d5458356dea5110b8f77e6b5..365b546eb35a765c1b1e98e61ea021efedbbc338 100644 (file)
@@ -244,6 +244,7 @@ CONFIG_VARIABLE (int, vst_scan_timeout, "vst-scan-timeout", 1200) /* deciseconds
 CONFIG_VARIABLE (bool, discover_audio_units, "discover-audio-units", false)
 CONFIG_VARIABLE (bool, ask_replace_instrument, "ask-replace-instrument", true)
 CONFIG_VARIABLE (bool, ask_setup_instrument, "ask-setup-instrument", true)
+CONFIG_VARIABLE (uint32_t, limit_n_automatables, "limit-n-automatables", 512)
 
 /* custom user plugin paths */
 CONFIG_VARIABLE (std::string, plugin_path_vst, "plugin-path-vst", "@default@")
index 2f60024ff027858b865df73853d4e49ac0bb5384..fd7c0a9b01bc7d8b7c3c097b954e04cfba53a40f 100644 (file)
@@ -240,16 +240,24 @@ Automatable::set_automation_xml_state (const XMLNode& node, Evoral::Parameter le
                                continue;
                        }
 
-                       if (_can_automate_list.find (param) == _can_automate_list.end ()) {
-                               warning << "Ignored automation data for non-automatable parameter" << endl;
-                               continue;
-                       }
-
                        if (!id_prop) {
                                warning << "AutomationList node without automation-id property, "
                                        << "using default: " << EventTypeMap::instance().to_symbol(legacy_param) << endmsg;
                        }
 
+                       if (_can_automate_list.find (param) == _can_automate_list.end ()) {
+                               boost::shared_ptr<AutomationControl> actl = automation_control (param);
+                               if (actl && (*niter)->children().size() > 0 && Config->get_limit_n_automatables () > 0) {
+                                       actl->set_flags (Controllable::Flag ((int)actl->flags() & ~Controllable::NotAutomatable));
+                                       can_automate (param);
+                                       info << "Marked parmater as automatable" << endl;
+                               } else {
+                                       warning << "Ignored automation data for non-automatable parameter" << endl;
+                                       continue;
+                               }
+                       }
+
+
                        boost::shared_ptr<AutomationControl> existing = automation_control (param);
 
                        if (existing) {
index 2537f8d2324787ffc9e4fbd011de3b92b5af3e76..d5056e725990b996befa4e8ae2ae491675561b10 100644 (file)
@@ -434,6 +434,8 @@ PluginInsert::create_automatable_parameters ()
        boost::shared_ptr<Plugin> plugin = _plugins.front();
        set<Evoral::Parameter> a = _plugins.front()->automatable ();
 
+       const uint32_t limit_automatables = Config->get_limit_n_automatables ();
+
        for (uint32_t i = 0; i < plugin->parameter_count(); ++i) {
                if (!plugin->parameter_is_control (i)) {
                        continue;
@@ -452,7 +454,7 @@ PluginInsert::create_automatable_parameters ()
 
                boost::shared_ptr<AutomationList> list(new AutomationList(param, desc));
                boost::shared_ptr<AutomationControl> c (new PluginControl(this, param, desc, list));
-               if (!automatable) {
+               if (!automatable || (limit_automatables > 0 && i > limit_automatables)) {
                        c->set_flags (Controllable::Flag ((int)c->flags() | Controllable::NotAutomatable));
                }
                add_control (c);