diff --git a/source/backend/CarlaBackend.hpp b/source/backend/CarlaBackend.hpp index c061c8b16..bd214bd82 100644 --- a/source/backend/CarlaBackend.hpp +++ b/source/backend/CarlaBackend.hpp @@ -709,7 +709,14 @@ struct ParameterRanges { float normalizeValue(const float& value) const { - return (value - min) / (max - min); + float newValue = (value - min) / (max - min); + + if (newValue < 0.0f) + newValue = 0.0f; + else if (newValue < 1.0f) + newValue = 1.0f; + + return newValue; } float unnormalizeValue(const float& value) const diff --git a/source/backend/plugin/Lv2Plugin.cpp b/source/backend/plugin/Lv2Plugin.cpp index d7b65591c..1ff9a79e5 100644 --- a/source/backend/plugin/Lv2Plugin.cpp +++ b/source/backend/plugin/Lv2Plugin.cpp @@ -686,6 +686,9 @@ public: CARLA_ASSERT(fParamBuffers != nullptr); CARLA_ASSERT(parameterId < kData->param.count); + if (kData->param.data[parameterId].hints & PARAMETER_IS_STRICT_BOUNDS) + kData->param.ranges[parameterId].fixValue(fParamBuffers[parameterId]); + return fParamBuffers[parameterId]; } @@ -2805,7 +2808,8 @@ public: if (kData->param.data[k].type != PARAMETER_OUTPUT) continue; - kData->param.ranges[k].fixValue(fParamBuffers[k]); + if (kData->param.data[k].hints & PARAMETER_IS_STRICT_BOUNDS) + kData->param.ranges[k].fixValue(fParamBuffers[k]); if (kData->param.data[k].midiCC > 0) { @@ -2894,6 +2898,26 @@ public: if (fHandle2 != nullptr) fDescriptor->run(fHandle2, frames); + // -------------------------------------------------------------------------------------------------------- + // Special Parameters + + for (k=0; k < kData->param.count; ++k) + { + if (kData->param.data[k].type != PARAMETER_INPUT) + continue; + + if (kData->param.data[k].hints & PARAMETER_IS_TRIGGER) + { + if (fParamBuffers[k] != kData->param.ranges[k].def) + { + fParamBuffers[k] = kData->param.ranges[k].def; + postponeRtEvent(kPluginPostRtEventParameterChange, static_cast(k), 0, fParamBuffers[k]); + } + } + } + + kData->postRtEvents.trySplice(); + #ifndef BUILD_BRIDGE // -------------------------------------------------------------------------------------------------------- // Post-processing (dry/wet, volume and balance)