diff --git a/distrho/src/DistrhoPluginLV2.cpp b/distrho/src/DistrhoPluginLV2.cpp index 35ede034..ddfec995 100644 --- a/distrho/src/DistrhoPluginLV2.cpp +++ b/distrho/src/DistrhoPluginLV2.cpp @@ -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; diff --git a/distrho/src/DistrhoPluginLV2export.cpp b/distrho/src/DistrhoPluginLV2export.cpp index d4b2121d..0afdbfb7 100644 --- a/distrho/src/DistrhoPluginLV2export.cpp +++ b/distrho/src/DistrhoPluginLV2export.cpp @@ -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; diff --git a/distrho/src/DistrhoUILV2.cpp b/distrho/src/DistrhoUILV2.cpp index 5ab909b5..783c59f2 100644 --- a/distrho/src/DistrhoUILV2.cpp +++ b/distrho/src/DistrhoUILV2.cpp @@ -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;