From 17b4863a76d30c2a42fe4244ffc2ca46512de4b2 Mon Sep 17 00:00:00 2001 From: Johannes Lorenz <1042576+JohannesLorenz@users.noreply.github.com> Date: Sun, 23 Jan 2022 14:44:39 +0100 Subject: [PATCH] More LV2 buf-size features (#6254) Implement `LV2_BUF_SIZE__boundedBlockLength` and `LV2_BUF_SIZE__fixedBlockLength`. --- src/core/lv2/Lv2Features.cpp | 10 +++++++++- src/core/lv2/Lv2Manager.cpp | 5 +++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/core/lv2/Lv2Features.cpp b/src/core/lv2/Lv2Features.cpp index fe668807e..74d2415b0 100644 --- a/src/core/lv2/Lv2Features.cpp +++ b/src/core/lv2/Lv2Features.cpp @@ -69,7 +69,15 @@ void Lv2Features::createFeatureVectors() // create vector of features for(std::pair& pr : m_featureByUri) { - Q_ASSERT(pr.second != nullptr); + /* + If pr.second is nullptr here, this means that the LV2_feature + has no "data". If this happens here, this means + * either that this feature is static + (e.g. LV2_BUF_SIZE__boundedBlockLength) + * or that the programmer forgot to use operator[] before feature + vector creation (This can be done in + Lv2Proc::initPluginSpecificFeatures or in Lv2Features::initCommon) + */ m_features.push_back(LV2_Feature { pr.first, pr.second }); } diff --git a/src/core/lv2/Lv2Manager.cpp b/src/core/lv2/Lv2Manager.cpp index ed2d05053..25fab7002 100644 --- a/src/core/lv2/Lv2Manager.cpp +++ b/src/core/lv2/Lv2Manager.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -78,6 +79,10 @@ Lv2Manager::Lv2Manager() : m_supportedFeatureURIs.insert(LV2_URID__map); m_supportedFeatureURIs.insert(LV2_URID__unmap); m_supportedFeatureURIs.insert(LV2_OPTIONS__options); + // min/max is always passed in the options + m_supportedFeatureURIs.insert(LV2_BUF_SIZE__boundedBlockLength); + // block length is only changed initially in AudioEngine CTOR + m_supportedFeatureURIs.insert(LV2_BUF_SIZE__fixedBlockLength); auto supportOpt = [this](Lv2UridCache::Id id) {