mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-05 05:05:43 +01:00
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
This commit is contained in:
parent
a9e00793fe
commit
30a4ba74b2
3 changed files with 28 additions and 4 deletions
|
|
@ -57,7 +57,7 @@ LV2PluginUI::LV2PluginUI (boost::shared_ptr<PluginInsert> pi, boost::shared_ptr<
|
|||
{
|
||||
_inst = slv2_ui_instantiate(
|
||||
_lv2->slv2_plugin(), _lv2->slv2_ui(), LV2PluginUI::lv2_ui_write, this,
|
||||
/* FEATURES */ NULL);
|
||||
_lv2->features());
|
||||
|
||||
GtkWidget* c_widget = (GtkWidget*)slv2_ui_instance_get_widget(_inst);
|
||||
_gui_widget = Glib::wrap(c_widget);
|
||||
|
|
|
|||
|
|
@ -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 ();
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue