diff --git a/gtk2_ardour/generic_pluginui.cc b/gtk2_ardour/generic_pluginui.cc index 3f8d0f63c9..6306c051e5 100644 --- a/gtk2_ardour/generic_pluginui.cc +++ b/gtk2_ardour/generic_pluginui.cc @@ -264,6 +264,11 @@ GenericPluginUI::build () continue; } + const std::string param_docs = plugin->get_parameter_docs(i); + if (param_docs != "") { + ARDOUR_UI::instance()->set_tip(cui, param_docs.c_str()); + } + if (cui->controller || cui->clickbox || cui->combo) { // Get all of the controls into a list, so that // we can lay them out a bit more nicely later. diff --git a/libs/ardour/ardour/lv2_plugin.h b/libs/ardour/ardour/lv2_plugin.h index 51d88a672d..b72b7d605b 100644 --- a/libs/ardour/ardour/lv2_plugin.h +++ b/libs/ardour/ardour/lv2_plugin.h @@ -50,14 +50,15 @@ class LV2Plugin : public ARDOUR::Plugin, public ARDOUR::Workee const char* name () const; const char* maker () const; - uint32_t num_ports () const; - uint32_t parameter_count () const; - float default_value (uint32_t port); - framecnt_t signal_latency () const; - void set_parameter (uint32_t port, float val); - float get_parameter (uint32_t port) const; - int get_parameter_descriptor (uint32_t which, ParameterDescriptor&) const; - uint32_t nth_parameter (uint32_t port, bool& ok) const; + uint32_t num_ports () const; + uint32_t parameter_count () const; + float default_value (uint32_t port); + framecnt_t signal_latency () const; + void set_parameter (uint32_t port, float val); + float get_parameter (uint32_t port) const; + std::string get_parameter_docs(uint32_t which) const; + 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) const; diff --git a/libs/ardour/ardour/plugin.h b/libs/ardour/ardour/plugin.h index d73fef2f53..bade84341b 100644 --- a/libs/ardour/ardour/plugin.h +++ b/libs/ardour/ardour/plugin.h @@ -118,6 +118,7 @@ class Plugin : public PBD::StatefulDestructible, public Latent virtual uint32_t parameter_count () const = 0; virtual float default_value (uint32_t port) = 0; virtual float get_parameter(uint32_t which) const = 0; + virtual std::string get_parameter_docs(uint32_t which) const { return ""; } virtual int get_parameter_descriptor (uint32_t which, ParameterDescriptor&) const = 0; virtual uint32_t nth_parameter (uint32_t which, bool& ok) const = 0; diff --git a/libs/ardour/lv2_plugin.cc b/libs/ardour/lv2_plugin.cc index dc312a099b..bd628e46bd 100644 --- a/libs/ardour/lv2_plugin.cc +++ b/libs/ardour/lv2_plugin.cc @@ -108,6 +108,7 @@ public: LilvNode* lv2_sampleRate; LilvNode* lv2_toggled; LilvNode* midi_MidiEvent; + LilvNode* rdfs_comment; LilvNode* ui_GtkUI; LilvNode* ui_external; }; @@ -583,6 +584,23 @@ LV2Plugin::get_parameter(uint32_t which) const return 0.0f; } +std::string +LV2Plugin::get_parameter_docs(uint32_t which) const +{ + LilvNodes* comments = lilv_port_get_value( + _impl->plugin, + lilv_plugin_get_port_by_index(_impl->plugin, which), + _world.rdfs_comment); + + if (comments) { + const std::string docs(lilv_node_as_string(lilv_nodes_get_first(comments))); + lilv_nodes_free(comments); + return docs; + } + + return ""; +} + uint32_t LV2Plugin::nth_parameter(uint32_t n, bool& ok) const { @@ -1466,6 +1484,7 @@ LV2World::LV2World() lv2_toggled = lilv_new_uri(world, LILV_NS_LV2 "toggled"); lv2_enumeration = lilv_new_uri(world, LILV_NS_LV2 "enumeration"); midi_MidiEvent = lilv_new_uri(world, LILV_URI_MIDI_EVENT); + rdfs_comment = lilv_new_uri(world, LILV_NS_RDFS "comment"); ui_GtkUI = lilv_new_uri(world, NS_UI "GtkUI"); ui_external = lilv_new_uri(world, NS_UI "external"); }