summaryrefslogtreecommitdiff
path: root/libs/ardour/ladspa_plugin.cc
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2009-10-15 00:57:55 +0000
committerCarl Hetherington <carl@carlh.net>2009-10-15 00:57:55 +0000
commit79f91c7a205d981d2b8cc15e32a6da02d8423065 (patch)
treef27dd8319522be8321720ef3560c2207dd56b158 /libs/ardour/ladspa_plugin.cc
parent09efd82c6aea973e3eb9497ef2b09256bf5ddde4 (diff)
Part 1 of loading 2.X sessions; some things work, some things don't, hacks a-plenty.
LOADING 2.X SESSIONS WITH THIS COMMIT IN PLACE WILL (PROBABLY) CORRUPT THE .ardour FILE, MAKING THE SESSION UNLOADABLE ON 2.X AND LOSING INFORMATION. So don't do that unless you make a backup of the session file first. git-svn-id: svn://localhost/ardour2/branches/3.0@5786 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/ladspa_plugin.cc')
-rw-r--r--libs/ardour/ladspa_plugin.cc57
1 files changed, 56 insertions, 1 deletions
diff --git a/libs/ardour/ladspa_plugin.cc b/libs/ardour/ladspa_plugin.cc
index 70a8390de1..6e2acfbe09 100644
--- a/libs/ardour/ladspa_plugin.cc
+++ b/libs/ardour/ladspa_plugin.cc
@@ -378,8 +378,12 @@ LadspaPlugin::save_preset (string name)
}
int
-LadspaPlugin::set_state(const XMLNode& node)
+LadspaPlugin::set_state (const XMLNode& node, int version)
{
+ if (version < 3000) {
+ return set_state_2X (node, version);
+ }
+
XMLNodeList nodes;
XMLProperty *prop;
XMLNodeConstIterator iter;
@@ -389,6 +393,9 @@ LadspaPlugin::set_state(const XMLNode& node)
uint32_t port_id;
LocaleGuard lg (X_("POSIX"));
+ cout << "LADSPA Plugin set state " << version << "\n";
+ cout << "- node " << node.name() << "\n";
+
if (node.name() != state_node_name()) {
error << _("Bad node sent to LadspaPlugin::set_state") << endmsg;
return -1;
@@ -423,6 +430,54 @@ LadspaPlugin::set_state(const XMLNode& node)
}
int
+LadspaPlugin::set_state_2X (const XMLNode& node, int version)
+{
+ XMLNodeList nodes;
+ XMLProperty *prop;
+ XMLNodeConstIterator iter;
+ XMLNode *child;
+ const char *port;
+ const char *data;
+ uint32_t port_id;
+ LocaleGuard lg (X_("POSIX"));
+
+ cout << "LADSPA Plugin set state " << version << "\n";
+ cout << "- node " << node.name() << "\n";
+
+ if (node.name() != state_node_name()) {
+ error << _("Bad node sent to LadspaPlugin::set_state") << endmsg;
+ return -1;
+ }
+
+ nodes = node.children ("port");
+
+ for(iter = nodes.begin(); iter != nodes.end(); ++iter){
+
+ child = *iter;
+
+ if ((prop = child->property("number")) != 0) {
+ port = prop->value().c_str();
+ } else {
+ warning << _("LADSPA: no ladspa port number") << endmsg;
+ continue;
+ }
+ if ((prop = child->property("value")) != 0) {
+ data = prop->value().c_str();
+ } else {
+ warning << _("LADSPA: no ladspa port data") << endmsg;
+ continue;
+ }
+
+ sscanf (port, "%" PRIu32, &port_id);
+ set_parameter (port_id, atof(data));
+ }
+
+ latency_compute_run ();
+
+ return 0;
+}
+
+int
LadspaPlugin::get_parameter_descriptor (uint32_t which, ParameterDescriptor& desc) const
{
LADSPA_PortRangeHint prh;