diff --git a/gtk2_ardour/lv2_plugin_ui.cc b/gtk2_ardour/lv2_plugin_ui.cc index bd0198921d..1e2af6ad92 100644 --- a/gtk2_ardour/lv2_plugin_ui.cc +++ b/gtk2_ardour/lv2_plugin_ui.cc @@ -19,6 +19,10 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#ifdef WAF_BUILD +#include "gtk2ardour-config.h" +#endif + #include #include "ardour/lv2_plugin.h" @@ -135,19 +139,22 @@ LV2PluginUI::set_path_property (int response, active_parameter_requests.erase (desc.key); } -uint32_t -LV2PluginUI::request_parameter (void* handle, LV2_URID key) +#ifdef HAVE_LV2_1_17_2 +LV2UI_Request_Value_Status +LV2PluginUI::request_value(void* handle, + LV2_URID key, + LV2_URID type, + const LV2_Feature* const* features) { LV2PluginUI* me = (LV2PluginUI*)handle; - /* This will return `PropertyDescriptors nothing` when not found */ const ParameterDescriptor& desc (me->_lv2->get_property_descriptor(key)); - if (desc.datatype != Variant::PATH) { - return 0; - } - - if (me->active_parameter_requests.find (key) != me->active_parameter_requests.end()) { - return 0; /* already showing dialog */ + if (desc.key == (uint32_t)-1) { + return LV2UI_REQUEST_VALUE_ERR_UNKNOWN; + } else if (desc.datatype != Variant::PATH) { + return LV2UI_REQUEST_VALUE_ERR_UNSUPPORTED; + } else if (me->active_parameter_requests.count (key)) { + return LV2UI_REQUEST_VALUE_BUSY; } me->active_parameter_requests.insert (key); @@ -173,8 +180,9 @@ LV2PluginUI::request_parameter (void* handle, LV2_URID key) lv2ui_file_dialog->signal_response().connect (sigc::bind (sigc::mem_fun (*me, &LV2PluginUI::set_path_property), desc, lv2ui_file_dialog)); lv2ui_file_dialog->present(); - return 0; + return LV2UI_REQUEST_VALUE_SUCCESS; } +#endif void LV2PluginUI::update_timeout() @@ -341,11 +349,11 @@ LV2PluginUI::lv2ui_instantiate(const std::string& title) features[fi] = features_src[fi]; } -#if 0 - _lv2ui_request_paramater.handle = this; - _lv2ui_request_paramater.request = LV2PluginUI::request_parameter; - _lv2ui_request_feature.URI = LV2_UI_PREFIX "requestParameter"; - _lv2ui_request_feature.data = &_lv2ui_request_paramater; +#ifdef HAVE_LV2_1_17_2 + _lv2ui_request_value.handle = this; + _lv2ui_request_value.request = LV2PluginUI::request_value; + _lv2ui_request_feature.URI = LV2_UI__requestValue; + _lv2ui_request_feature.data = &_lv2ui_request_value; features[fi++] = &_lv2ui_request_feature; #endif @@ -381,7 +389,11 @@ LV2PluginUI::lv2ui_instantiate(const std::string& title) } features[fi] = NULL; +#ifdef HAVE_LV2_1_17_2 + assert (fi == features_count + (is_external_ui ? 3 : 1)); +#else assert (fi == features_count + (is_external_ui ? 2 : 1)); +#endif if (!ui_host) { ui_host = suil_host_new(LV2PluginUI::write_from_ui, diff --git a/gtk2_ardour/lv2_plugin_ui.h b/gtk2_ardour/lv2_plugin_ui.h index 2b16f5080b..b22b8ec5c3 100644 --- a/gtk2_ardour/lv2_plugin_ui.h +++ b/gtk2_ardour/lv2_plugin_ui.h @@ -44,12 +44,6 @@ #include "lv2_external_ui.h" #include "lv2/lv2plug.in/ns/extensions/ui/ui.h" -#if 0 -typedef struct _LV2UI_Request_Parameter { - LV2UI_Feature_Handle handle; - uint32_t (*request)(LV2UI_Feature_Handle handle, LV2_URID key); -}LV2UI_Request_Parameter; -#endif namespace ARDOUR { class PluginInsert; @@ -92,8 +86,8 @@ private: struct lv2_external_ui_host _external_ui_host; LV2_Feature _external_ui_feature; LV2_Feature _external_kxui_feature; -#if 0 - LV2UI_Request_Parameter _lv2ui_request_paramater; +#ifdef HAVE_LV2_1_17_2 + LV2UI_Request_Value _lv2ui_request_value; LV2_Feature _lv2ui_request_feature; #endif struct lv2_external_ui* _external_ui_ptr; @@ -122,7 +116,14 @@ private: uint32_t port_index, bool grabbed); - static uint32_t request_parameter (void* handle, LV2_URID key); +#ifdef HAVE_LV2_1_17_2 + static LV2UI_Request_Value_Status + request_value(void* handle, + LV2_URID key, + LV2_URID type, + const LV2_Feature* const* features); +#endif + void set_path_property (int, const ARDOUR::ParameterDescriptor&, Gtk::FileChooserDialog*); diff --git a/libs/ardour/wscript b/libs/ardour/wscript index e03fbf65e4..a5cd387dba 100644 --- a/libs/ardour/wscript +++ b/libs/ardour/wscript @@ -309,6 +309,8 @@ def configure(conf): atleast_version='1.2.0', mandatory=True) autowaf.check_pkg(conf, 'lv2', uselib_store='LV2_1_10_0', atleast_version='1.10.0', mandatory=False) + autowaf.check_pkg(conf, 'lv2', uselib_store='LV2_1_17_2', + atleast_version='1.17.2', mandatory=False) autowaf.check_pkg(conf, 'serd-0', uselib_store='SERD', atleast_version='0.14.0', mandatory=True) autowaf.check_pkg(conf, 'sord-0', uselib_store='SORD',