summaryrefslogtreecommitdiff
path: root/libs/ardour/ardour/lv2_plugin.h
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2016-07-31 21:59:21 -0400
committerDavid Robillard <d@drobilla.net>2016-07-31 21:59:21 -0400
commit7c2302651559eda71833c291ddc17f4d590ad95a (patch)
tree32cc32fe32d36acf0693c0834e2ff97b89eefb0e /libs/ardour/ardour/lv2_plugin.h
parentae71e57e2422466716c0ec68ac841d778cf26e94 (diff)
Support thread-safe LV2 state restoration
The original LV2 state extension required that run() is suspended during restore(). Ardour violates this rule, which can lead to crashes and other issues. The state extension has been updated to allow restoring state in a thread-safe way by using the worker to enqueue state changes. This commit supports that new specification, i.e. supports dropout-free state restoration properly. However, the bug with old plugins that do not use this facility is still not fixed.
Diffstat (limited to 'libs/ardour/ardour/lv2_plugin.h')
-rw-r--r--libs/ardour/ardour/lv2_plugin.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/libs/ardour/ardour/lv2_plugin.h b/libs/ardour/ardour/lv2_plugin.h
index efd4903e07..7f312459f5 100644
--- a/libs/ardour/ardour/lv2_plugin.h
+++ b/libs/ardour/ardour/lv2_plugin.h
@@ -20,6 +20,7 @@
#ifndef __ardour_lv2_plugin_h__
#define __ardour_lv2_plugin_h__
+#include <glibmm/threads.h>
#include <set>
#include <string>
#include <vector>
@@ -163,7 +164,7 @@ class LIBARDOUR_API LV2Plugin : public ARDOUR::Plugin, public ARDOUR::Workee
URIMap& uri_map() { return _uri_map; }
const URIMap& uri_map() const { return _uri_map; }
- int work(uint32_t size, const void* data);
+ int work(Worker& worker, uint32_t size, const void* data);
int work_response(uint32_t size, const void* data);
void set_property(uint32_t key, const Variant& value);
@@ -177,6 +178,7 @@ class LIBARDOUR_API LV2Plugin : public ARDOUR::Plugin, public ARDOUR::Workee
void* _module;
LV2_Feature** _features;
Worker* _worker;
+ Worker* _state_worker;
framecnt_t _sample_rate;
float* _control_data;
float* _shadow_data;
@@ -268,6 +270,8 @@ class LIBARDOUR_API LV2Plugin : public ARDOUR::Plugin, public ARDOUR::Workee
RingBuffer<uint8_t>* _to_ui;
RingBuffer<uint8_t>* _from_ui;
+ Glib::Threads::Mutex _work_mutex;
+
#ifdef LV2_EXTENDED
const LV2_Inline_Display_Interface* _display_interface;
#endif