13
0

finally get to the bottom of where NO_PLUGIN_STATE needs to be in order to be useful

This commit is contained in:
Paul Davis 2013-07-15 22:23:16 -04:00
parent 90f5eb4a31
commit 9cb678ebcc
6 changed files with 27 additions and 22 deletions

View File

@ -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;

View File

@ -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;
}

View File

@ -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);
}

View File

@ -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<Evoral::Control> 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
}
}
}

View File

@ -2558,27 +2558,9 @@ Route::set_processor_state (const XMLNode& node)
continue;
}
if (boost::dynamic_pointer_cast<PluginInsert>(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

View File

@ -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;