Browse Source

Fix storage of the bypass parameter in LV2 preset manifest

pull/232/head
JP Cimalando falkTX <falktx@falktx.com> 2 years ago
parent
commit
8616522d5a
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
1 changed files with 15 additions and 4 deletions
  1. +15
    -4
      distrho/src/DistrhoPluginLV2export.cpp

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

@@ -75,6 +75,8 @@
#define DISTRHO_LV2_USE_EVENTS_IN (DISTRHO_PLUGIN_WANT_MIDI_INPUT || DISTRHO_PLUGIN_WANT_TIMEPOS || (DISTRHO_PLUGIN_WANT_STATE && DISTRHO_PLUGIN_HAS_UI))
#define DISTRHO_LV2_USE_EVENTS_OUT (DISTRHO_PLUGIN_WANT_MIDI_OUTPUT || (DISTRHO_PLUGIN_WANT_STATE && DISTRHO_PLUGIN_HAS_UI))

#define DISTRHO_BYPASS_PARAMETER_NAME "lv2_enabled"

// -----------------------------------------------------------------------
static const char* const lv2ManifestPluginExtensionData[] =
{
@@ -541,7 +543,7 @@ void lv2_generate_ttl(const char* const basename)
case kParameterDesignationBypass:
designated = true;
pluginString += " lv2:name \"Enabled\" ;\n";
pluginString += " lv2:symbol \"lv2_enabled\" ;\n";
pluginString += " lv2:symbol \"" DISTRHO_BYPASS_PARAMETER_NAME "\" ;\n";
pluginString += " lv2:default 1 ;\n";
pluginString += " lv2:minimum 0 ;\n";
pluginString += " lv2:maximum 1 ;\n";
@@ -872,12 +874,21 @@ void lv2_generate_ttl(const char* const basename)
presetString += " [\n";
}

presetString += " lv2:symbol \"" + plugin.getParameterSymbol(j) + "\" ;\n";
String parameterSymbol = plugin.getParameterSymbol(j);
float parameterValue = plugin.getParameterValue(j);

if (plugin.getParameterDesignation(j) == kParameterDesignationBypass)
{
parameterSymbol = DISTRHO_BYPASS_PARAMETER_NAME;
parameterValue = 1.0f - parameterValue;
}

presetString += " lv2:symbol \"" + parameterSymbol + "\" ;\n";

if (plugin.getParameterHints(j) & kParameterIsInteger)
presetString += " pset:value " + String(int(plugin.getParameterValue(j))) + " ;\n";
presetString += " pset:value " + String(int(parameterValue)) + " ;\n";
else
presetString += " pset:value " + String(plugin.getParameterValue(j)) + " ;\n";
presetString += " pset:value " + String(parameterValue) + " ;\n";

if (j+1 == numParameters || plugin.isParameterOutput(j+1))
presetString += " ] .\n\n";


Loading…
Cancel
Save