Fix state version for copy-construction (1/2)

In some cases copying an instance requires an explicit
set_state() call (e.g. copy internal plugin state). This is
done by calling `set_state(other->get_state())`.

::get_state() produces XML as matching current_state_version.
(not loading_state_version).
This commit is contained in:
Robin Gareus 2022-11-04 17:51:09 +01:00
parent 0aad0ae464
commit 619d523bbe
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
5 changed files with 5 additions and 5 deletions

View File

@ -420,7 +420,7 @@ LV2Plugin::LV2Plugin (const LV2Plugin& other)
XMLNode root (other.state_node_name ());
other.add_state (&root);
set_state (root, Stateful::loading_state_version);
set_state (root, Stateful::current_state_version);
for (uint32_t i = 0; i < parameter_count(); ++i) {
_control_data[i] = other._shadow_data[i];

View File

@ -61,7 +61,7 @@ LXVSTPlugin::LXVSTPlugin (const LXVSTPlugin &other)
XMLNode* root = new XMLNode (other.state_node_name ());
other.add_state (root);
set_state (*root, Stateful::loading_state_version);
set_state (*root, Stateful::current_state_version);
delete root;
init_plugin ();

View File

@ -59,7 +59,7 @@ MacVSTPlugin::MacVSTPlugin (const MacVSTPlugin &other)
XMLNode* root = new XMLNode (other.state_node_name ());
other.add_state (root);
set_state (*root, Stateful::loading_state_version);
set_state (*root, Stateful::current_state_version);
delete root;
init_plugin ();

View File

@ -181,7 +181,7 @@ PluginInsert::set_count (uint32_t num)
if (require_state) {
XMLNode& state = _plugins[0]->get_state ();
p->set_state (state, Stateful::loading_state_version);
p->set_state (state, Stateful::current_state_version);
}
if (active ()) {

View File

@ -60,7 +60,7 @@ WindowsVSTPlugin::WindowsVSTPlugin (const WindowsVSTPlugin &other)
XMLNode* root = new XMLNode (other.state_node_name ());
other.add_state (root);
set_state (*root, Stateful::loading_state_version);
set_state (*root, Stateful::current_state_version);
delete root;
init_plugin ();