summaryrefslogtreecommitdiff
path: root/libs/ardour/lv2_plugin.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2016-08-23 13:40:42 +0200
committerRobin Gareus <robin@gareus.org>2016-08-23 13:46:11 +0200
commit4a831725af84d5b9ed013d51a0c9fef99041717c (patch)
treea8144a817f27517e9dd6aa721d42b62d68999e37 /libs/ardour/lv2_plugin.cc
parent81c481f9756a29d9817e38ed79a895d8867cf618 (diff)
fix threaded state restore (duplicate calls to restore during init)
and also allow immediate work during use latency-compute runs. At session load, Ardour calls a plugins "set default" state (GUI thread). Some plugins may schedule work during state-restore. Ardour immediately proceeded to restore the actual session plugin state without processing the already scheduled work and without calling run() for a plugin to apply state synchronously.
Diffstat (limited to 'libs/ardour/lv2_plugin.cc')
-rw-r--r--libs/ardour/lv2_plugin.cc13
1 files changed, 10 insertions, 3 deletions
diff --git a/libs/ardour/lv2_plugin.cc b/libs/ardour/lv2_plugin.cc
index 2992dd65c1..e0498b7d3c 100644
--- a/libs/ardour/lv2_plugin.cc
+++ b/libs/ardour/lv2_plugin.cc
@@ -558,6 +558,13 @@ LV2Plugin::init(const void* c_plugin, framecnt_t rate)
#ifdef HAVE_LILV_0_16_0
// Load default state
+ if (_worker) {
+ /* immediately schedule any work,
+ * so that state restore later will not find a busy
+ * worker. latency_compute_run() flushes any replies
+ */
+ _worker->set_synchronous(true);
+ }
LilvState* state = lilv_state_new_from_world(
_world.world, _uri_map.urid_map(), lilv_plugin_get_uri(_impl->plugin));
if (state && _has_state_interface) {
@@ -2830,7 +2837,7 @@ LV2Plugin::get_scale_points(uint32_t port_index) const
}
void
-LV2Plugin::run(pframes_t nframes)
+LV2Plugin::run(pframes_t nframes, bool sync_work)
{
uint32_t const N = parameter_count();
for (uint32_t i = 0; i < N; ++i) {
@@ -2841,7 +2848,7 @@ LV2Plugin::run(pframes_t nframes)
if (_worker) {
// Execute work synchronously if we're freewheeling (export)
- _worker->set_synchronous(session().engine().freewheeling());
+ _worker->set_synchronous(sync_work || session().engine().freewheeling());
}
// Run the plugin for this cycle
@@ -2902,7 +2909,7 @@ LV2Plugin::latency_compute_run()
port_index++;
}
- run(bufsize);
+ run(bufsize, true);
deactivate();
if (was_activated) {
activate();