diff options
author | David Robillard <d@drobilla.net> | 2008-08-09 00:49:07 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2008-08-09 00:49:07 +0000 |
commit | daf91bc21def66a2d4a875bb1c32c8cb6fcf176b (patch) | |
tree | e9c98e981d0b03d540ff1b805ebcd9f9961816bd /libs | |
parent | a35abc05287a6fd8e1e91f24aa4f829201d0e4e1 (diff) |
Embedded LV2 GTK GUI support.
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3678 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/ardour/lv2_plugin.h | 7 | ||||
-rw-r--r-- | libs/ardour/insert.cc | 8 | ||||
-rw-r--r-- | libs/ardour/lv2_plugin.cc | 19 |
3 files changed, 31 insertions, 3 deletions
diff --git a/libs/ardour/ardour/lv2_plugin.h b/libs/ardour/ardour/lv2_plugin.h index 852d277bfc..8d58c7024d 100644 --- a/libs/ardour/ardour/lv2_plugin.h +++ b/libs/ardour/ardour/lv2_plugin.h @@ -61,6 +61,7 @@ class LV2Plugin : public ARDOUR::Plugin uint32_t nth_parameter (uint32_t port, bool& ok) const; 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); } std::set<uint32_t> automatable() const; @@ -103,14 +104,13 @@ class LV2Plugin : public ARDOUR::Plugin int set_state(const XMLNode& node); bool save_preset(std::string name); - bool has_editor() const { return false; } + bool has_editor() const; - int require_output_streams (uint32_t); - private: void* _module; LV2World& _world; SLV2Plugin _plugin; + SLV2UI _ui; SLV2Value _name; SLV2Value _author; SLV2Instance _instance; @@ -146,6 +146,7 @@ struct LV2World { SLV2Value integer; SLV2Value toggled; SLV2Value srate; + SLV2Value gtk_gui; }; diff --git a/libs/ardour/insert.cc b/libs/ardour/insert.cc index 75f428aeb4..9af73e9a7d 100644 --- a/libs/ardour/insert.cc +++ b/libs/ardour/insert.cc @@ -844,6 +844,9 @@ PluginInsert::type () #ifdef HAVE_AUDIOUNITS boost::shared_ptr<AUPlugin> ap; #endif +#ifdef HAVE_LV2 + boost::shared_ptr<LV2Plugin> lv2p; +#endif PluginPtr other = plugin (); @@ -857,7 +860,12 @@ PluginInsert::type () } else if ((ap = boost::dynamic_pointer_cast<AUPlugin> (other)) != 0) { return ARDOUR::AudioUnit; #endif +#ifdef HAVE_LV2 + } else if ((lv2p = boost::dynamic_pointer_cast<LV2Plugin> (other)) != 0) { + return ARDOUR::LV2; +#endif } else { + error << "Unknown plugin type" << endmsg; /* NOT REACHED */ return (ARDOUR::PluginType) 0; } diff --git a/libs/ardour/lv2_plugin.cc b/libs/ardour/lv2_plugin.cc index 015c47e317..028d0c5b45 100644 --- a/libs/ardour/lv2_plugin.cc +++ b/libs/ardour/lv2_plugin.cc @@ -68,6 +68,7 @@ LV2Plugin::init (LV2World& world, SLV2Plugin plugin, nframes_t rate) { _world = world; _plugin = plugin; + _ui = NULL; _control_data = 0; _shadow_data = 0; _latency_control_port = 0; @@ -124,6 +125,17 @@ LV2Plugin::init (LV2World& world, SLV2Plugin plugin, nframes_t rate) _defaults[i] = 0.0f; } } + + SLV2UIs uis = slv2_plugin_get_uis(_plugin); + if (slv2_uis_size(uis) > 0) { + for (unsigned i=0; i < slv2_uis_size(uis); ++i) { + SLV2UI ui = slv2_uis_get_at(uis, i); + if (slv2_ui_is_a(ui, _world.gtk_gui)) { + _ui = ui; + break; + } + } + } Plugin::setup_controls (); @@ -243,6 +255,12 @@ LV2Plugin::save_preset (string name) { return Plugin::save_preset (name, "lv2"); } + +bool +LV2Plugin::has_editor() const +{ + return (_ui != NULL); +} int LV2Plugin::set_state(const XMLNode& node) @@ -505,6 +523,7 @@ LV2World::LV2World() integer = slv2_value_new_uri(world, SLV2_NAMESPACE_LV2 "integer"); toggled = slv2_value_new_uri(world, SLV2_NAMESPACE_LV2 "toggled"); srate = slv2_value_new_uri(world, SLV2_NAMESPACE_LV2 "sampleRate"); + gtk_gui = slv2_value_new_uri(world, "http://lv2plug.in/ns/extensions/ui#GtkUI"); } LV2World::~LV2World() |