summaryrefslogtreecommitdiff
path: root/libs/ardour/lv2_plugin.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2019-02-28 04:17:54 +0100
committerRobin Gareus <robin@gareus.org>2019-02-28 04:48:32 +0100
commit4397ec9ce68d28b93f53ca3ab5201203f628dff9 (patch)
tree6d69fd97888b93b1ffd013ce5218c266b11c1099 /libs/ardour/lv2_plugin.cc
parent5714e390f85799c23d6057c654a43a465ffcdcad (diff)
Properly copy LV2 plugin instances on replication
This fixes issues for stateful plugins and plugins with previously loaded preset.
Diffstat (limited to 'libs/ardour/lv2_plugin.cc')
-rw-r--r--libs/ardour/lv2_plugin.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/libs/ardour/lv2_plugin.cc b/libs/ardour/lv2_plugin.cc
index 2ba1a994d7..9f270f33b2 100644
--- a/libs/ardour/lv2_plugin.cc
+++ b/libs/ardour/lv2_plugin.cc
@@ -371,6 +371,7 @@ LV2Plugin::LV2Plugin (AudioEngine& engine,
, _no_sample_accurate_ctrl (false)
{
init(c_plugin, rate);
+ latency_compute_run();
}
LV2Plugin::LV2Plugin (const LV2Plugin& other)
@@ -388,10 +389,16 @@ LV2Plugin::LV2Plugin (const LV2Plugin& other)
{
init(other._impl->plugin, other._sample_rate);
+ XMLNode root (other.state_node_name ());
+ other.add_state (&root);
+ set_state (root, Stateful::loading_state_version);
+
for (uint32_t i = 0; i < parameter_count(); ++i) {
_control_data[i] = other._shadow_data[i];
_shadow_data[i] = other._shadow_data[i];
}
+
+ latency_compute_run();
}
void
@@ -817,6 +824,8 @@ LV2Plugin::init(const void* c_plugin, samplecnt_t rate)
if (params[i]) {
*params[i] = (void*)&_shadow_data[i];
}
+ } else {
+ _shadow_data[i] = 0;
}
} else {
_defaults[i] = 0.0f;
@@ -873,7 +882,6 @@ LV2Plugin::init(const void* c_plugin, samplecnt_t rate)
load_supported_properties(_property_descriptors);
allocate_atom_event_buffers();
- latency_compute_run();
}
int