Browse Source

Fix integer rounding for exported lv2 enumerations

Closes #270
Fixes #258

Signed-off-by: falkTX <falktx@falktx.com>
pull/277/head
falkTX 4 years ago
parent
commit
aa20320f9a
1 changed files with 6 additions and 4 deletions
  1. +6
    -4
      distrho/src/DistrhoPluginLV2export.cpp

+ 6
- 4
distrho/src/DistrhoPluginLV2export.cpp View File

@@ -1,6 +1,6 @@
/* /*
* DISTRHO Plugin Framework (DPF) * 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 * 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 * 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"; 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"; pluginString += " rdf:value " + String(roundedValue) + " ;\n";
} }
else {
else
{
pluginString += " rdf:value " + String(enumValue.value) + " ;\n"; pluginString += " rdf:value " + String(enumValue.value) + " ;\n";
} }




Loading…
Cancel
Save