commit aa20320f9a64ddcdf8d00e59fd8d06e35fec51ce
parent 22ad4700a4d540739248c9cd184c0ca9bbd1903a
Author: falkTX <falktx@falktx.com>
Date: Mon, 24 May 2021 09:58:21 +0100
Fix integer rounding for exported lv2 enumerations
Closes #270
Fixes #258
Signed-off-by: falkTX <falktx@falktx.com>
Diffstat:
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/distrho/src/DistrhoPluginLV2export.cpp b/distrho/src/DistrhoPluginLV2export.cpp
@@ -1,6 +1,6 @@
/*
* DISTRHO Plugin Framework (DPF)
- * Copyright (C) 2012-2020 Filipe Coelho <falktx@falktx.com>
+ * Copyright (C) 2012-2021 Filipe Coelho <falktx@falktx.com>
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with
* or without fee is hereby granted, provided that the above copyright notice and this
@@ -608,11 +608,13 @@ void lv2_generate_ttl(const char* const basename)
pluginString += " rdfs:label \"\"\"" + enumValue.label + "\"\"\" ;\n";
- if (plugin.getParameterHints(i) & kParameterIsInteger) {
- const int roundedValue = (int)(enumValue.value + 0.5f);
+ if (plugin.getParameterHints(i) & kParameterIsInteger)
+ {
+ const int roundedValue = (int)(enumValue.value + enumValue.value < 0.0f ? -0.5f : 0.5f);
pluginString += " rdf:value " + String(roundedValue) + " ;\n";
}
- else {
+ else
+ {
pluginString += " rdf:value " + String(enumValue.value) + " ;\n";
}