diff options
author | Robin Gareus <robin@gareus.org> | 2015-12-17 23:47:50 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2015-12-17 23:47:50 +0100 |
commit | 7383ea6a35a249a87780b66aba856be6c5c40963 (patch) | |
tree | c7c8ef7e153db802a0498bb0313492f36b921684 /libs/ardour | |
parent | b48d87b3ea2e3e4d7e62fd7880f15dbce28c49ea (diff) |
properly copy plugin state when duplicating routes. #6709
This is not a really elegant solution. Something had to come up and
ruin the neatness of the thread-private regenerate_xml_or_string_ids :)
Diffstat (limited to 'libs/ardour')
-rw-r--r-- | libs/ardour/plugin_insert.cc | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/libs/ardour/plugin_insert.cc b/libs/ardour/plugin_insert.cc index 551602324a..b56419096e 100644 --- a/libs/ardour/plugin_insert.cc +++ b/libs/ardour/plugin_insert.cc @@ -1113,6 +1113,18 @@ PluginInsert::set_state(const XMLNode& node, int version) } } + PBD::ID this_id = this->id(); + + if (regenerate_xml_or_string_ids ()) { + /* when duplicating a track, we need to use the + * original ID for loading plugin state (from file) + */ + const XMLProperty* prop; + if ((prop = node.property ("id")) != 0) { + plugin->set_insert_id (prop->value ()); + } + } + Processor::set_state (node, version); for (niter = nlist.begin(); niter != nlist.end(); ++niter) { @@ -1124,14 +1136,23 @@ PluginInsert::set_state(const XMLNode& node, int version) if ((*niter)->name() == plugin->state_node_name()) { for (Plugins::iterator i = _plugins.begin(); i != _plugins.end(); ++i) { - (*i)->set_insert_id (this->id()); + if (!regenerate_xml_or_string_ids ()) { + (*i)->set_insert_id (this->id()); + } (*i)->set_state (**niter, version); + if (regenerate_xml_or_string_ids ()) { + (*i)->set_insert_id (this_id); + } } break; } } + if (regenerate_xml_or_string_ids ()) { + plugin->set_insert_id (this_id); + } + if (version < 3000) { /* Only 2.X sessions need a call to set_parameter_state() - in 3.X and above |