diff --git a/distrho/src/DistrhoPluginLV2.cpp b/distrho/src/DistrhoPluginLV2.cpp index cd76bffe..35ede034 100644 --- a/distrho/src/DistrhoPluginLV2.cpp +++ b/distrho/src/DistrhoPluginLV2.cpp @@ -23,6 +23,7 @@ #include "lv2/instance-access.h" #include "lv2/midi.h" #include "lv2/options.h" +#include "lv2/parameters.h" #include "lv2/state.h" #include "lv2/time.h" #include "lv2/urid.h" @@ -685,7 +686,7 @@ public: { if (options[i].type == fURIDs.atomInt) { - const int bufferSize(*(const int*)options[i].value); + const int32_t bufferSize(*(const int32_t*)options[i].value); fPlugin.setBufferSize(bufferSize); } else @@ -697,7 +698,7 @@ public: { if (options[i].type == fURIDs.atomInt) { - const int bufferSize(*(const int*)options[i].value); + const int32_t bufferSize(*(const int32_t*)options[i].value); fPlugin.setBufferSize(bufferSize); } else @@ -705,11 +706,11 @@ public: d_stderr("Host changed maxBlockLength but with wrong value type"); } } - else if (options[i].key == fUridMap->map(fUridMap->handle, LV2_CORE__sampleRate)) + else if (options[i].key == fUridMap->map(fUridMap->handle, LV2_PARAMETERS__sampleRate)) { - if (options[i].type == fURIDs.atomDouble) + if (options[i].type == fURIDs.atomFloat) { - const double sampleRate(*(const double*)options[i].value); + const float sampleRate(*(const float*)options[i].value); fSampleRate = sampleRate; fPlugin.setSampleRate(sampleRate); } diff --git a/distrho/src/DistrhoPluginLV2export.cpp b/distrho/src/DistrhoPluginLV2export.cpp index 961d62bd..295525b5 100644 --- a/distrho/src/DistrhoPluginLV2export.cpp +++ b/distrho/src/DistrhoPluginLV2export.cpp @@ -201,6 +201,7 @@ void lv2_generate_ttl(const char* const basename) #ifdef DISTRHO_PLUGIN_BRAND pluginString += "@prefix mod: .\n"; #endif + pluginString += "@prefix opts: <" LV2_OPTIONS_PREFIX "> .\n"; pluginString += "@prefix rdfs: .\n"; pluginString += "@prefix rsz: <" LV2_RESIZE_PORT_PREFIX "> .\n"; #if DISTRHO_PLUGIN_HAS_UI @@ -254,6 +255,12 @@ void lv2_generate_ttl(const char* const basename) #endif pluginString += ";\n\n"; + // supportedOptions + pluginString += " opts:supportedOption <" LV2_BUF_SIZE__nominalBlockLength "> ,\n"; + pluginString += " <" LV2_BUF_SIZE__maxBlockLength "> ,\n"; + pluginString += " <" LV2_PARAMETERS__sampleRate "> ;\n"; + pluginString += "\n"; + // UI #if DISTRHO_PLUGIN_HAS_UI pluginString += " ui:ui <" DISTRHO_UI_URI "> ;\n"; @@ -583,8 +590,9 @@ void lv2_generate_ttl(const char* const basename) std::fstream uiFile(uiTTL, std::ios::out); String uiString; - uiString += "@prefix lv2: <" LV2_CORE_PREFIX "> .\n"; - uiString += "@prefix ui: <" LV2_UI_PREFIX "> .\n"; + uiString += "@prefix lv2: <" LV2_CORE_PREFIX "> .\n"; + uiString += "@prefix ui: <" LV2_UI_PREFIX "> .\n"; + uiString += "@prefix opts: <" LV2_OPTIONS_PREFIX "> .\n"; uiString += "\n"; uiString += "<" DISTRHO_UI_URI ">\n"; @@ -603,7 +611,9 @@ void lv2_generate_ttl(const char* const basename) uiString += "\n"; # endif uiString += " lv2:requiredFeature <" LV2_OPTIONS__options "> ,\n"; - uiString += " <" LV2_URID__map "> .\n"; + uiString += " <" LV2_URID__map "> ;\n"; + + uiString += " opts:supportedOption <" LV2_PARAMETERS__sampleRate "> .\n"; uiFile << uiString << std::endl; uiFile.close();