From 30ba386bc69a7a799d29f2c5262cf209991f7efa Mon Sep 17 00:00:00 2001 From: Christopher Arndt Date: Mon, 4 Nov 2019 22:45:33 +0100 Subject: [PATCH] Export LV2 scalePoint for integer ports as integer values not float (#195) * Export LV2 scalePoint for integer ports as integer values not float Signed-off-by: Christopher Arndt * Round int scale point value instead of truncating Signed-off-by: Christopher Arndt * Name roundedValue properly and make it const Signed-off-by: Christopher Arndt --- distrho/src/DistrhoPluginLV2export.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/distrho/src/DistrhoPluginLV2export.cpp b/distrho/src/DistrhoPluginLV2export.cpp index 0afe4fad..681b1b1b 100644 --- a/distrho/src/DistrhoPluginLV2export.cpp +++ b/distrho/src/DistrhoPluginLV2export.cpp @@ -561,7 +561,14 @@ void lv2_generate_ttl(const char* const basename) pluginString += " [\n"; pluginString += " rdfs:label \"\"\"" + enumValue.label + "\"\"\" ;\n"; - pluginString += " rdf:value " + String(enumValue.value) + " ;\n"; + + if (plugin.getParameterHints(i) & kParameterIsInteger) { + const int roundedValue = (int)(enumValue.value + 0.5f); + pluginString += " rdf:value " + String(roundedValue) + " ;\n"; + } + else { + pluginString += " rdf:value " + String(enumValue.value) + " ;\n"; + } if (j+1 == enumValues.count) pluginString += " ] ;\n\n";