Package: jalv / 1.0.0~dfsg0-2

0001-presets_with_non_decimal_ports.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Description: Tolerate loading presets with port values that aren't xsd:decimal
Origin: http://dev.drobilla.net/changeset/4499
---
 src/state.c |   15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

--- jalv.orig/src/state.c
+++ jalv/src/state.c
@@ -132,14 +132,21 @@ set_port_value(const char* port_symbol,
 		return;
 	}
 
-	if (type != jalv->forge.Float) {
-		fprintf(stderr, "error: Preset port `%s' value is a <%s>, not float\n",
+	float fvalue;
+	if (type == jalv->forge.Float) {
+		fvalue = *(float*)value;
+	} else if (type == jalv->forge.Double) {
+		fvalue = *(double*)value;
+	} else if (type == jalv->forge.Int) {
+		fvalue = *(int32_t*)value;
+	} else if (type == jalv->forge.Long) {
+		fvalue = *(int64_t*)value;
+	} else {
+		fprintf(stderr, "error: Preset `%s' value has bad type <%s>\n",
 		        port_symbol, jalv->unmap.unmap(jalv->unmap.handle, type));
 		return;
 	}
 
-	const float fvalue = *(float*)value;
-
 	// Send value to plugin
 	jalv_ui_write(jalv, port->index, sizeof(fvalue), 0, &fvalue);