Browse Source

Accept lv2:sampleRate too just in case

pull/29/head
Henna Haahti 8 years ago
parent
commit
d1f449c7ee
3 changed files with 30 additions and 1 deletions
  1. +13
    -0
      distrho/src/DistrhoPluginLV2.cpp
  2. +3
    -1
      distrho/src/DistrhoPluginLV2export.cpp
  3. +14
    -0
      distrho/src/DistrhoUILV2.cpp

+ 13
- 0
distrho/src/DistrhoPluginLV2.cpp View File

@@ -719,6 +719,19 @@ public:
d_stderr("Host changed sampleRate but with wrong value type");
}
}
else if (options[i].key == fUridMap->map(fUridMap->handle, LV2_CORE__sampleRate))
{
if (options[i].type == fURIDs.atomDouble)
{
const double sampleRate(*(const double*)options[i].value);
fSampleRate = sampleRate;
fPlugin.setSampleRate(sampleRate);
}
else
{
d_stderr("Host changed sampleRate but with wrong value type");
}
}
}

return LV2_OPTIONS_SUCCESS;


+ 3
- 1
distrho/src/DistrhoPluginLV2export.cpp View File

@@ -259,6 +259,7 @@ void lv2_generate_ttl(const char* const basename)
pluginString += " opts:supportedOption <" LV2_BUF_SIZE__nominalBlockLength "> ";
pluginString += ",\n <" LV2_BUF_SIZE__maxBlockLength "> ";
pluginString += ",\n <" LV2_PARAMETERS__sampleRate "> ";
pluginString += ",\n <" LV2_CORE__sampleRate "> ";
pluginString += ";\n\n";

// UI
@@ -613,7 +614,8 @@ void lv2_generate_ttl(const char* const basename)
uiString += " lv2:requiredFeature <" LV2_OPTIONS__options "> ,\n";
uiString += " <" LV2_URID__map "> ;\n";

uiString += " opts:supportedOption <" LV2_PARAMETERS__sampleRate "> .";
uiString += " opts:supportedOption <" LV2_PARAMETERS__sampleRate "> ,\n";
uiString += " opts:supportedOption <" LV2_CORE__sampleRate "> .";
uiString += "\n\n";

uiFile << uiString << std::endl;


+ 14
- 0
distrho/src/DistrhoUILV2.cpp View File

@@ -190,6 +190,20 @@ public:
continue;
}
}
else if (options[i].key == fUridMap->map(fUridMap->handle, LV2_CORE__sampleRate))
{
if (options[i].type == fUridMap->map(fUridMap->handle, LV2_ATOM__Double))
{
const double sampleRate(*(const double*)options[i].value);
fUI.setSampleRate(sampleRate);
continue;
}
else
{
d_stderr("Host changed sampleRate but with wrong value type");
continue;
}
}
}

return LV2_OPTIONS_SUCCESS;


Loading…
Cancel
Save