PluginInsert::automation_snapshot (jack_nframes_t now)
{
map<uint32_t,AutomationList*>::iterator li;
-
+
for (li = parameter_automation.begin(); li != parameter_automation.end(); ++li) {
- AutomationList& alist (*((*li).second));
- if (alist.automation_write ()) {
+ AutomationList *alist = ((*li).second);
+ if (alist != 0 && alist->automation_write ()) {
float val = _plugins[0]->get_parameter ((*li).first);
- alist.rt_add (now, val);
+ alist->rt_add (now, val);
last_automation_snapshot = now;
}
}
node->add_property ("type", _plugins[0]->state_node_name());
snprintf(buf, sizeof(buf), "%s", _plugins[0]->name());
node->add_property("id", string(buf));
+ if (_plugins[0]->state_node_name() == "ladspa") {
+ char buf[32];
+ snprintf (buf, 31, "%ld", _plugins[0]->get_info().unique_id);
+ node->add_property("unique-id", string(buf));
+ }
node->add_property("count", string_compose("%1", _plugins.size()));
node->add_child_nocopy (_plugins[0]->get_state());
XMLNodeIterator niter;
XMLPropertyList plist;
const XMLProperty *prop;
+ long unique = 0;
PluginInfo::Type type;
if ((prop = node.property ("type")) == 0) {
return -1;
}
+ prop = node.property ("unique-id");
+ if (prop != 0) {
+ unique = atol(prop->value().c_str());
+ }
+
if ((prop = node.property ("id")) == 0) {
error << _("XML node describing insert is missing the `id' field") << endmsg;
return -1;
Plugin* plugin;
- if ((plugin = find_plugin (_session, prop->value(), type)) == 0) {
+ if (unique != 0) {
+ plugin = find_plugin (_session, "", unique, type);
+ } else {
+ plugin = find_plugin (_session, prop->value(), 0, type);
+ }
+
+ if (plugin == 0) {
error << string_compose(_("Found a reference to a plugin (\"%1\") that is unknown.\n"
"Perhaps it was removed or moved since it was last used."), prop->value())
<< endmsg;
warning << string_compose(_("XML node describing a port automation is missing the `%1' information"), port_automation_node_name) << endmsg;
}
+ // The name of the PluginInsert comes from the plugin, nothing else
+ set_name(plugin->get_info().name,this);
return 0;
}