summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-08-12 01:13:26 +0000
committerDavid Robillard <d@drobilla.net>2008-08-12 01:13:26 +0000
commit30a4ba74b2a1870f2204481cbe9681ead9da9fd0 (patch)
tree1304c0dc7264be9a6e9faf3763f28204ee6856e7 /libs
parenta9e00793fe9a843fecb8936ff27ad01f87226981 (diff)
Support for the LV2 'data access' and 'instance access' extensions (for in-process GUIs).
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3684 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/ardour/lv2_plugin.h10
-rw-r--r--libs/ardour/lv2_plugin.cc20
2 files changed, 27 insertions, 3 deletions
diff --git a/libs/ardour/ardour/lv2_plugin.h b/libs/ardour/ardour/lv2_plugin.h
index 8d58c7024d..be584b76c3 100644
--- a/libs/ardour/ardour/lv2_plugin.h
+++ b/libs/ardour/ardour/lv2_plugin.h
@@ -60,10 +60,14 @@ class LV2Plugin : public ARDOUR::Plugin
int get_parameter_descriptor (uint32_t which, ParameterDescriptor&) const;
uint32_t nth_parameter (uint32_t port, bool& ok) const;
+ const void* extension_data(const char* uri) { return _instance->lv2_descriptor->extension_data(uri); }
+
SLV2Plugin slv2_plugin() { return _plugin; }
SLV2UI slv2_ui() { return _ui; }
SLV2Port slv2_port(uint32_t i) { return slv2_plugin_get_port_by_index(_plugin, i); }
+ const LV2_Feature* const* features() { return _features; }
+
std::set<uint32_t> automatable() const;
void activate () {
@@ -109,6 +113,7 @@ class LV2Plugin : public ARDOUR::Plugin
private:
void* _module;
LV2World& _world;
+ LV2_Feature** _features;
SLV2Plugin _plugin;
SLV2UI _ui;
SLV2Value _name;
@@ -122,6 +127,11 @@ class LV2Plugin : public ARDOUR::Plugin
bool _was_activated;
vector<bool> _port_is_input;
+ typedef struct { const void* (*extension_data)(const char* uri); } LV2_DataAccess;
+ LV2_DataAccess _data_access_extension_data;
+ LV2_Feature _data_access_feature;
+ LV2_Feature _instance_access_feature;
+
void init (LV2World& world, SLV2Plugin plugin, nframes_t rate);
void run (nframes_t nsamples);
void latency_compute_run ();
diff --git a/libs/ardour/lv2_plugin.cc b/libs/ardour/lv2_plugin.cc
index 028d0c5b45..1b9f278012 100644
--- a/libs/ardour/lv2_plugin.cc
+++ b/libs/ardour/lv2_plugin.cc
@@ -43,10 +43,11 @@
using namespace std;
using namespace ARDOUR;
using namespace PBD;
-
+
LV2Plugin::LV2Plugin (AudioEngine& e, Session& session, LV2World& world, SLV2Plugin plugin, nframes_t rate)
: Plugin (e, session)
, _world(world)
+ , _features(NULL)
{
init (world, plugin, rate);
}
@@ -54,6 +55,7 @@ LV2Plugin::LV2Plugin (AudioEngine& e, Session& session, LV2World& world, SLV2Plu
LV2Plugin::LV2Plugin (const LV2Plugin &other)
: Plugin (other)
, _world(other._world)
+ , _features(NULL)
{
init (other._world, other._plugin, other._sample_rate);
@@ -73,8 +75,8 @@ LV2Plugin::init (LV2World& world, SLV2Plugin plugin, nframes_t rate)
_shadow_data = 0;
_latency_control_port = 0;
_was_activated = false;
-
- _instance = slv2_plugin_instantiate(plugin, rate, NULL);
+
+ _instance = slv2_plugin_instantiate(plugin, rate, _features);
_name = slv2_plugin_get_name(plugin);
assert(_name);
_author = slv2_plugin_get_author_name(plugin);
@@ -91,6 +93,18 @@ LV2Plugin::init (LV2World& world, SLV2Plugin plugin, nframes_t rate)
slv2_value_free(_author);
throw failed_constructor();
}
+
+ _instance_access_feature.URI = "http://lv2plug.in/ns/ext/instance-access";
+ _instance_access_feature.data = (void*)_instance->lv2_handle;
+
+ _data_access_extension_data.extension_data = _instance->lv2_descriptor->extension_data;
+ _data_access_feature.URI = "http://lv2plug.in/ns/ext/data-access";
+ _data_access_feature.data = &_data_access_extension_data;
+
+ _features = (LV2_Feature**)malloc(sizeof(LV2_Feature*) * 3);
+ _features[0] = &_instance_access_feature;
+ _features[1] = &_data_access_feature;
+ _features[2] = NULL;
_sample_rate = rate;