From 9cb678ebcc2ca0c7993bdd182c9e6ad1f8adf09a Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 15 Jul 2013 22:23:16 -0400 Subject: finally get to the bottom of where NO_PLUGIN_STATE needs to be in order to be useful --- libs/ardour/audio_unit.cc | 2 ++ libs/ardour/ladspa_plugin.cc | 10 ++++++++++ libs/ardour/lv2_plugin.cc | 3 +++ libs/ardour/plugin_insert.cc | 6 ++++++ libs/ardour/route.cc | 24 +++--------------------- libs/ardour/vst_plugin.cc | 4 +++- 6 files changed, 27 insertions(+), 22 deletions(-) diff --git a/libs/ardour/audio_unit.cc b/libs/ardour/audio_unit.cc index 0e9a11e6df..20a55e49f9 100644 --- a/libs/ardour/audio_unit.cc +++ b/libs/ardour/audio_unit.cc @@ -1717,6 +1717,7 @@ AUPlugin::set_state(const XMLNode& node, int version) return -1; } +#ifndef NO_PLUGIN_STATE if (node.children().empty()) { return -1; } @@ -1752,6 +1753,7 @@ AUPlugin::set_state(const XMLNode& node, int version) } CFRelease (propertyList); } +#endif Plugin::set_state (node, version); return ret; diff --git a/libs/ardour/ladspa_plugin.cc b/libs/ardour/ladspa_plugin.cc index cebff59771..1ab00e0b34 100644 --- a/libs/ardour/ladspa_plugin.cc +++ b/libs/ardour/ladspa_plugin.cc @@ -34,6 +34,7 @@ #include "pbd/compose.h" #include "pbd/error.h" #include "pbd/xml++.h" +#include "pbd/stacktrace.h" #include "midi++/manager.h" @@ -360,6 +361,7 @@ LadspaPlugin::set_state (const XMLNode& node, int version) return set_state_2X (node, version); } +#ifndef NO_PLUGIN_STATE XMLNodeList nodes; XMLProperty *prop; XMLNodeConstIterator iter; @@ -367,6 +369,7 @@ LadspaPlugin::set_state (const XMLNode& node, int version) const char *port; const char *data; uint32_t port_id; +#endif LocaleGuard lg (X_("POSIX")); if (node.name() != state_node_name()) { @@ -374,6 +377,8 @@ LadspaPlugin::set_state (const XMLNode& node, int version) return -1; } +#ifndef NO_PLUGIN_STATE + nodes = node.children ("Port"); for (iter = nodes.begin(); iter != nodes.end(); ++iter) { @@ -396,6 +401,7 @@ LadspaPlugin::set_state (const XMLNode& node, int version) sscanf (port, "%" PRIu32, &port_id); set_parameter (port_id, atof(data)); } +#endif latency_compute_run (); @@ -405,6 +411,7 @@ LadspaPlugin::set_state (const XMLNode& node, int version) int LadspaPlugin::set_state_2X (const XMLNode& node, int /* version */) { +#ifndef NO_PLUGIN_STATE XMLNodeList nodes; XMLProperty *prop; XMLNodeConstIterator iter; @@ -412,6 +419,7 @@ LadspaPlugin::set_state_2X (const XMLNode& node, int /* version */) const char *port; const char *data; uint32_t port_id; +#endif LocaleGuard lg (X_("POSIX")); if (node.name() != state_node_name()) { @@ -419,6 +427,7 @@ LadspaPlugin::set_state_2X (const XMLNode& node, int /* version */) return -1; } +#ifndef NO_PLUGIN_STATE nodes = node.children ("port"); for(iter = nodes.begin(); iter != nodes.end(); ++iter){ @@ -443,6 +452,7 @@ LadspaPlugin::set_state_2X (const XMLNode& node, int /* version */) } latency_compute_run (); +#endif return 0; } diff --git a/libs/ardour/lv2_plugin.cc b/libs/ardour/lv2_plugin.cc index df33e6c38d..5ea76934a5 100644 --- a/libs/ardour/lv2_plugin.cc +++ b/libs/ardour/lv2_plugin.cc @@ -1233,6 +1233,8 @@ LV2Plugin::set_state(const XMLNode& node, int version) return -1; } +#ifndef NO_PLUGIN_STATE + if (version < 3000) { nodes = node.children("port"); } else { @@ -1288,6 +1290,7 @@ LV2Plugin::set_state(const XMLNode& node, int version) } latency_compute_run(); +#endif return Plugin::set_state(node, version); } diff --git a/libs/ardour/plugin_insert.cc b/libs/ardour/plugin_insert.cc index 23cebf4276..998a03e3aa 100644 --- a/libs/ardour/plugin_insert.cc +++ b/libs/ardour/plugin_insert.cc @@ -882,7 +882,12 @@ PluginInsert::set_control_ids (const XMLNode& node, int version) if ((prop = (*iter)->property (X_("parameter"))) != 0) { uint32_t p = atoi (prop->value()); + + /* this may create the new controllable */ + boost::shared_ptr c = control (Evoral::Parameter (PluginAutomation, 0, p)); + +#ifndef NO_PLUGIN_STATE if (!c) { continue; } @@ -890,6 +895,7 @@ PluginInsert::set_control_ids (const XMLNode& node, int version) if (ac) { ac->set_state (**iter, version); } +#endif } } } diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index d48fbeff96..dad1922488 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -2558,27 +2558,9 @@ Route::set_processor_state (const XMLNode& node) continue; } - if (boost::dynamic_pointer_cast(processor)) { - cerr << "Working on plugin processor state for " << processor->name() << endl; -#ifndef NO_PLUGIN_STATE - cerr << "plugin state allowed\n"; - if (processor->set_state (**niter, Stateful::current_state_version) != 0) { - /* This processor could not be configured. Turn it into a UnknownProcessor */ - processor.reset (new UnknownProcessor (_session, **niter)); - } -#else - cerr << "plugin state dis-allowed\n"; - /* plugin, with NO_PLUGIN_STATE defined - * =>::set_state() not allowed. Do not - * display a message here - things will - * get too verbose. - */ -#endif - } else { - if (processor->set_state (**niter, Stateful::current_state_version) != 0) { - /* This processor could not be configured. Turn it into a UnknownProcessor */ - processor.reset (new UnknownProcessor (_session, **niter)); - } + if (processor->set_state (**niter, Stateful::current_state_version) != 0) { + /* This processor could not be configured. Turn it into a UnknownProcessor */ + processor.reset (new UnknownProcessor (_session, **niter)); } /* we have to note the monitor send here, otherwise a new one will be created diff --git a/libs/ardour/vst_plugin.cc b/libs/ardour/vst_plugin.cc index c385e71a5a..b80a594495 100644 --- a/libs/ardour/vst_plugin.cc +++ b/libs/ardour/vst_plugin.cc @@ -197,14 +197,15 @@ int VSTPlugin::set_state (const XMLNode& node, int version) { LocaleGuard lg (X_("POSIX")); + int ret = -1; if (node.name() != state_node_name()) { error << _("Bad node sent to VSTPlugin::set_state") << endmsg; return 0; } +#ifndef NO_PLUGIN_STATE XMLNode* child; - int ret = -1; if ((child = find_named_node (node, X_("chunk"))) != 0) { @@ -237,6 +238,7 @@ VSTPlugin::set_state (const XMLNode& node, int version) ret = 0; } +#endif Plugin::set_state (node, version); return ret; -- cgit v1.2.3