diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2006-11-28 21:12:20 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2006-11-28 21:12:20 +0000 |
commit | 4851c54a7b514473a69ddcc63b7eae6fc56a62e4 (patch) | |
tree | 1c3b8932afb90705f51c2eb4004a5d16efe13b90 | |
parent | c371600816bd50d519f76bafd228e12b7f1b42a6 (diff) |
save plugin automation state
git-svn-id: svn://localhost/ardour2/trunk@1166 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | libs/ardour/insert.cc | 85 |
1 files changed, 49 insertions, 36 deletions
diff --git a/libs/ardour/insert.cc b/libs/ardour/insert.cc index 77dd67a240..0416d3e1e4 100644 --- a/libs/ardour/insert.cc +++ b/libs/ardour/insert.cc @@ -614,14 +614,8 @@ PluginInsert::state (bool full) XMLNode* child = new XMLNode("port"); snprintf(buf, sizeof(buf), "%" PRIu32, *x); child->add_property("number", string(buf)); - - if (full) { - snprintf(buf, sizeof(buf), "0x%x", automation_list (*x).automation_state ()); - } else { - snprintf(buf, sizeof(buf), "0x%x", ARDOUR::Off); - } - child->add_property("auto", string(buf)); - + + child->add_child_nocopy (automation_list (*x).state (full)); autonode->add_child_nocopy (*child); } @@ -725,43 +719,62 @@ PluginInsert::set_state(const XMLNode& node) /* look for port automation node */ for (niter = nlist.begin(); niter != nlist.end(); ++niter) { - if ((*niter)->name() == port_automation_node_name) { - XMLNodeList cnodes; - XMLProperty *cprop; - XMLNodeConstIterator iter; - XMLNode *child; - const char *port; - uint32_t port_id; - - cnodes = (*niter)->children ("port"); - - for(iter = cnodes.begin(); iter != cnodes.end(); ++iter){ - - child = *iter; - - if ((cprop = child->property("number")) != 0) { - port = cprop->value().c_str(); - } else { - warning << _("PluginInsert: Auto: no ladspa port number") << endmsg; - continue; - } - sscanf (port, "%" PRIu32, &port_id); + if ((*niter)->name() != port_automation_node_name) { + continue; + } - if (port_id >= _plugins[0]->parameter_count()) { - warning << _("PluginInsert: Auto: port id out of range") << endmsg; - continue; - } - + XMLNodeList cnodes; + XMLProperty *cprop; + XMLNodeConstIterator iter; + XMLNode *child; + const char *port; + uint32_t port_id; + + cnodes = (*niter)->children ("port"); + + for(iter = cnodes.begin(); iter != cnodes.end(); ++iter){ + + child = *iter; + + if ((cprop = child->property("number")) != 0) { + port = cprop->value().c_str(); + } else { + warning << _("PluginInsert: Auto: no ladspa port number") << endmsg; + continue; + } + + sscanf (port, "%" PRIu32, &port_id); + + if (port_id >= _plugins[0]->parameter_count()) { + warning << _("PluginInsert: Auto: port id out of range") << endmsg; + continue; + } + + if (!child->children().empty()) { + automation_list (port_id).set_state (*child->children().front()); + } else { if ((cprop = child->property("auto")) != 0) { + + /* old school */ + int x; sscanf (cprop->value().c_str(), "0x%x", &x); automation_list (port_id).set_automation_state (AutoState (x)); + + } else { + + /* missing */ + + automation_list (port_id).set_automation_state (Off); } } - - break; + } + + /* done */ + + break; } if (niter == nlist.end()) { |