View Issue Details

IDProjectCategoryView StatusLast Update
0007837ardourfeaturespublic2019-10-28 16:30
Reporterrncbc Assigned Tox42  
PrioritynormalSeverityminorReproducibilityN/A
Status closedResolutionfixed 
PlatformSome Other LinuxOSSome Other LinuxOS Versionunknown
Product Version5.12 
Summary0007837: [PATCH] Pefer LV2UI:X11 when multiple UI options are provided by a LV2 plugin
Description- Let LV2 Plugin UI support (via SUIL) prefer and select a X11 UI whenever
  multiple UI type options are provided by LV2 plugins (eg. Vee-One's do
  present several but their native Qt5UI should never be raised by Ardour,
  on any chance:)).
  
  Signed-off-by: Rui Nuno Capela <rncbc@rncbc.org>
Steps To ReproduceN/A
Tagslv2, suil, x11

Activities

rncbc

2019-10-28 14:48

reporter  

ardour6-lv2_plugin-suil-prefer-x11-1.patch (2,926 bytes)   
- Let LV2 Plugin UI support (via SUIL) prefer and select a X11 UI whenever
  multiple UI type options are provided by LV2 plugins (eg. Vee-One's do
  present several but their native Qt5UI should never be raised by Ardour,
  on any chance:)).
  
  Signed-off-by: Rui Nuno Capela <rncbc@rncbc.org>


diff --git a/libs/ardour/lv2_plugin.cc b/libs/ardour/lv2_plugin.cc
index 5da1895d61..39c1220d04 100644
--- a/libs/ardour/lv2_plugin.cc
+++ b/libs/ardour/lv2_plugin.cc
@@ -182,6 +182,7 @@ public:
 	LilvNode* time_Position;
 	LilvNode* time_beatsPerMin;
 	LilvNode* ui_GtkUI;
+	LilvNode* ui_X11UI;
 	LilvNode* ui_external;
 	LilvNode* ui_externalkx;
 	LilvNode* units_hz;
@@ -848,19 +849,36 @@ LV2Plugin::init(const void* c_plugin, samplecnt_t rate)
 	if (lilv_uis_size(uis) > 0) {
 #ifdef HAVE_SUIL
 		// Look for embeddable UI
-		LILV_FOREACH(uis, u, uis) {
-			const LilvUI*   this_ui      = lilv_uis_get(uis, u);
-			const LilvNode* this_ui_type = NULL;
-			if (lilv_ui_is_supported(this_ui,
-			                         suil_ui_supported,
-			                         _world.ui_GtkUI,
-			                         &this_ui_type)) {
-				// TODO: Multiple UI support
-				_impl->ui      = this_ui;
-				_impl->ui_type = this_ui_type;
-				break;
+		// TODO: Multiple UI support
+		const LilvUI*   this_ui      = NULL;
+		const LilvNode* this_ui_type = NULL;
+		// Always prefer X11 UIs...
+		LILV_FOREACH(uis, i, uis) {
+			const LilvUI* ui = lilv_uis_get(uis, i);
+			if (lilv_ui_is_a(ui, _world.ui_X11UI)) {
+				this_ui      = ui;
+				this_ui_type = _world.ui_X11UI;
+				break;
+			}
+		}
+		// then anything else...
+		if (this_ui_type == NULL) {
+			LILV_FOREACH(uis, i, uis) {
+				const LilvUI* ui = lilv_uis_get(uis, i);
+				if (lilv_ui_is_supported(ui,
+									suil_ui_supported,
+									_world.ui_GtkUI,
+									&this_ui_type)) {
+					this_ui = ui;
+					break;
+				}
 			}
 		}
+		// Found one that is supported by SUIL?...
+		if (this_ui_type != NULL) {
+			_impl->ui      = this_ui;
+			_impl->ui_type = this_ui_type;
+		}
 #else
 		// Look for Gtk native UI
 		LILV_FOREACH(uis, i, uis) {
@@ -3266,6 +3284,7 @@ LV2World::LV2World()
 	time_Position      = lilv_new_uri(world, LV2_TIME__Position);
 	time_beatsPerMin   = lilv_new_uri(world, LV2_TIME__beatsPerMinute);
 	ui_GtkUI           = lilv_new_uri(world, LV2_UI__GtkUI);
+	ui_X11UI           = lilv_new_uri(world, LV2_UI__X11UI);
 	ui_external        = lilv_new_uri(world, "http://lv2plug.in/ns/extensions/ui#external");
 	ui_externalkx      = lilv_new_uri(world, "http://kxstudio.sf.net/ns/lv2ext/external-ui#Widget");
 	units_unit         = lilv_new_uri(world, LV2_UNITS__unit);
@@ -3318,6 +3337,7 @@ LV2World::~LV2World()
 	lilv_node_free(units_render);
 	lilv_node_free(ui_externalkx);
 	lilv_node_free(ui_external);
+	lilv_node_free(ui_X11UI);
 	lilv_node_free(ui_GtkUI);
 	lilv_node_free(time_beatsPerMin);
 	lilv_node_free(time_Position);

x42

2019-10-28 15:02

administrator   ~0020797

Applied as 6.0-pre0-2680-g760a7fda81 Thanks!

rncbc

2019-10-28 16:12

reporter   ~0020798

This second patch applies on top the last commit as for making sure the preferred LV2 X11 UI is actually supported by SUIL.
ardour6-lv2_plugin-suil-prefer-x11-2.patch (1,204 bytes)   
diff --git a/libs/ardour/lv2_plugin.cc b/libs/ardour/lv2_plugin.cc
index 6b1dbde4ca..f3bff0154f 100644
--- a/libs/ardour/lv2_plugin.cc
+++ b/libs/ardour/lv2_plugin.cc
@@ -855,15 +855,18 @@ LV2Plugin::init(const void* c_plugin, samplecnt_t rate)
 		// Always prefer X11 UIs...
 		LILV_FOREACH(uis, i, uis) {
 			const LilvUI* ui = lilv_uis_get(uis, i);
-			if (lilv_ui_is_a(ui, _world.ui_X11UI)) {
-				this_ui      = ui;
-				this_ui_type = _world.ui_X11UI;
+			if (lilv_ui_is_a(ui, _world.ui_X11UI) &&
+				lilv_ui_is_supported (ui,
+				                      suil_ui_supported,
+				                      world.ui_GtkUI,
+				                      &this_ui_type)) {
+				this_ui = ui;
 				break;
 			}
 		}
 #endif
-		// then anything else...
-		if (this_ui_type == NULL) {
+		// Then anything else...
+		if (this_ui == NULL) {
 			LILV_FOREACH(uis, i, uis) {
 				const LilvUI* ui = lilv_uis_get(uis, i);
 				if (lilv_ui_is_supported (ui,
@@ -876,7 +879,7 @@ LV2Plugin::init(const void* c_plugin, samplecnt_t rate)
 			}
 		}
 		// Found one that is supported by SUIL?...
-		if (this_ui_type != NULL) {
+		if (this_ui != NULL) {
 			_impl->ui      = this_ui;
 			_impl->ui_type = this_ui_type;
 		}

rncbc

2019-10-28 16:17

reporter   ~0020799

oops, there's a typo on last patch; consider this the correct one:
ardour6-lv2_plugin-suil-prefer-x11-2-2.patch (1,205 bytes)   
diff --git a/libs/ardour/lv2_plugin.cc b/libs/ardour/lv2_plugin.cc
index 6b1dbde4ca..f3bff0154f 100644
--- a/libs/ardour/lv2_plugin.cc
+++ b/libs/ardour/lv2_plugin.cc
@@ -855,15 +855,18 @@ LV2Plugin::init(const void* c_plugin, samplecnt_t rate)
 		// Always prefer X11 UIs...
 		LILV_FOREACH(uis, i, uis) {
 			const LilvUI* ui = lilv_uis_get(uis, i);
-			if (lilv_ui_is_a(ui, _world.ui_X11UI)) {
-				this_ui      = ui;
-				this_ui_type = _world.ui_X11UI;
+			if (lilv_ui_is_a(ui, _world.ui_X11UI) &&
+				lilv_ui_is_supported (ui,
+				                      suil_ui_supported,
+				                      _world.ui_GtkUI,
+				                      &this_ui_type)) {
+				this_ui = ui;
 				break;
 			}
 		}
 #endif
-		// then anything else...
-		if (this_ui_type == NULL) {
+		// Then anything else...
+		if (this_ui == NULL) {
 			LILV_FOREACH(uis, i, uis) {
 				const LilvUI* ui = lilv_uis_get(uis, i);
 				if (lilv_ui_is_supported (ui,
@@ -876,7 +879,7 @@ LV2Plugin::init(const void* c_plugin, samplecnt_t rate)
 			}
 		}
 		// Found one that is supported by SUIL?...
-		if (this_ui_type != NULL) {
+		if (this_ui != NULL) {
 			_impl->ui      = this_ui;
 			_impl->ui_type = this_ui_type;
 		}

x42

2019-10-28 16:30

administrator   ~0020800

Thanks again. applied as 6.0-pre0-2683-ge4601e54e9

Issue History

Date Modified Username Field Change
2019-10-28 14:48 rncbc New Issue
2019-10-28 14:48 rncbc Tag Attached: lv2
2019-10-28 14:48 rncbc Tag Attached: suil
2019-10-28 14:48 rncbc Tag Attached: x11
2019-10-28 14:48 rncbc File Added: ardour6-lv2_plugin-suil-prefer-x11-1.patch
2019-10-28 15:02 x42 Assigned To => x42
2019-10-28 15:02 x42 Status new => resolved
2019-10-28 15:02 x42 Resolution open => fixed
2019-10-28 15:02 x42 Note Added: 0020797
2019-10-28 16:12 rncbc File Added: ardour6-lv2_plugin-suil-prefer-x11-2.patch
2019-10-28 16:12 rncbc Note Added: 0020798
2019-10-28 16:17 rncbc File Added: ardour6-lv2_plugin-suil-prefer-x11-2-2.patch
2019-10-28 16:17 rncbc Note Added: 0020799
2019-10-28 16:30 x42 Status resolved => closed
2019-10-28 16:30 x42 Note Added: 0020800