View Issue Details

IDCategoryLast Update
0006828bugs2020-04-19 20:17
ReporterventosusAssigned Topaul 
Reproducibilityalways 
Status closedResolutionfixed 
PlatformanyOSanyOS Versionany
Product Version4.7 
Fixed in Version 
Summary0006828: Fix minimum/maximum discovery for integer params
DescriptionAs 'load_parameter_descriptor' is both used for lv2:ControlPorts and
lv2:Parameters, it needs to also be able to discover integer minimum
and maximum, as lv2:Parameters can be of type atom:Int/Long.
Steps To ReproduceDefine an integer parameter in a plugin's *.ttl and Ardour won't be able to discover its minimum/maximum correctly and will fall back to range [0, 1].

esp:through_zone_mask
  a lv2:Parameter ;
  rdfs:label "Zone Mask" ;
  rdfs:range atom:Int ;
  lv2:minimum 0 ;
  lv2:maximum 256 .

[...]
  patch:writable
    esp:through_zone_mask ;
[...]
Additional InformationPatch attached.
TagsNo tags attached.

Activities

ventosus

2016-03-19 13:29

reporter  

0001-Fix-minimum-maximum-discovery-for-integer-params.patch (1,786 bytes)
From 19ee34d582bbfd1ee4895b586eb76be1c2f8b9e5 Mon Sep 17 00:00:00 2001
From: Hanspeter Portner <dev@open-music-kontrollers.ch>
Date: Sat, 19 Mar 2016 14:21:03 +0100
Subject: [PATCH] Fix minimum/maximum discovery for integer params

As 'load_parameter_descriptor' is both used for lv2:ControlPorts and
lv2:Parameters, it needs to also be able to discover integer minimum
and maximum, as lv2:Parameters can be of type atom:Int/Long.
---
 libs/ardour/lv2_plugin.cc | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/libs/ardour/lv2_plugin.cc b/libs/ardour/lv2_plugin.cc
index d707d3e..f86d98a 100644
--- a/libs/ardour/lv2_plugin.cc
+++ b/libs/ardour/lv2_plugin.cc
@@ -1626,14 +1626,26 @@ load_parameter_descriptor(LV2World&            world,
 	if (label) {
 		desc.label = lilv_node_as_string(label);
 	}
-	if (def && lilv_node_is_float(def)) {
-		desc.normal = lilv_node_as_float(def);
+	if (def) {
+		if (lilv_node_is_float(def)) {
+			desc.normal = lilv_node_as_float(def);
+		} else if (lilv_node_is_int(def)) {
+			desc.normal = lilv_node_as_int(def);
+		}
 	}
-	if (minimum && lilv_node_is_float(minimum)) {
-		desc.lower = lilv_node_as_float(minimum);
+	if (minimum) {
+		if (lilv_node_is_float(minimum)) {
+			desc.lower = lilv_node_as_float(minimum);
+		} else if (lilv_node_is_int(minimum)) {
+			desc.lower = lilv_node_as_int(minimum);
+		}
 	}
-	if (maximum && lilv_node_is_float(maximum)) {
-		desc.upper = lilv_node_as_float(maximum);
+	if (maximum) {
+		if (lilv_node_is_float(maximum)) {
+			desc.upper = lilv_node_as_float(maximum);
+		} else if (lilv_node_is_int(maximum)) {
+			desc.upper = lilv_node_as_int(maximum);
+		}
 	}
 	load_parameter_descriptor_units(lworld, desc, units);
 	desc.datatype      = datatype;
-- 
2.7.3

ventosus

2016-12-09 13:22

reporter   ~0019135

update: still an issue in 5.5

x42

2016-12-19 22:51

administrator   ~0019181

a quick check on lilv's version history indicates that
lilv_node_is_float() is only available since 1e7b27c7b322476c437a8524cff4a88245c5efbf Fri Apr 29 19:30:30 2011

Ardour's minium requirement is 0.2.0, so this patch needs some #ifdef
or we need to bump the min version, which is sensible.

drobilla?

x42

2016-12-19 23:07

administrator   ~0019189

sorry, my bad. ardour needs lilv 0.14.0 (or later), it's sratom-0 that's at 0.2.0.

merge away

paul

2016-12-19 23:11

administrator   ~0019190

manually applied with patch(1) since git-apply fails. thanks!

paul

2016-12-19 23:11

administrator   ~0019191

see notes.

system

2020-04-19 20:17

developer   ~0023604

Issue has been closed automatically, by Trigger Close Plugin.
Feel free to re-open with additional information if you think the issue is not resolved.

Issue History

Date Modified Username Field Change
2016-03-19 13:29 ventosus New Issue
2016-03-19 13:29 ventosus File Added: 0001-Fix-minimum-maximum-discovery-for-integer-params.patch
2016-12-09 13:22 ventosus Note Added: 0019135
2016-12-19 22:51 x42 Note Added: 0019181
2016-12-19 23:07 x42 Note Added: 0019189
2016-12-19 23:11 paul Note Added: 0019190
2016-12-19 23:11 paul Note Added: 0019191
2016-12-19 23:11 paul Status new => resolved
2016-12-19 23:11 paul Resolution open => fixed
2016-12-19 23:11 paul Assigned To => paul
2020-04-19 20:17 system Note Added: 0023604
2020-04-19 20:17 system Status resolved => closed