17#pragma GCC diagnostic ignored "-Wparentheses"
18#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
19#elif defined(__clang__)
20#pragma clang diagnostic ignored "-Wparentheses"
21#pragma clang diagnostic ignored "-Wdeprecated-declarations"
27#include "lv2/buf-size/buf-size.h"
29#include "lv2/worker/worker.h"
37 , mBaseFeatures{ baseFeatures }
46 result.push_back(&feature);
47 result.push_back(
nullptr);
56 mFeatures.emplace_back(LV2_Feature{ uri,
const_cast<void*
>(data) });
73 , mSuppliesWorkerInterface{ SuppliesWorkerInterface(plug) }
74 , mOk{ InitializeFeatures() }
86 AddFeature(LV2_BUF_SIZE__boundedBlockLength,
nullptr);
87 AddFeature(LV2_BUF_SIZE__fixedBlockLength,
nullptr);
100 if (
LilvNodesPtr extdata{ lilv_plugin_get_extension_data(&plug) }) {
101 LILV_FOREACH(nodes, i, extdata.get()) {
102 const auto node = lilv_nodes_get(extdata.get(), i);
103 const auto uri = lilv_node_as_string(node);
104 if (strcmp(uri, LV2_WORKER__interface) == 0)
116 mFeatures.emplace_back(LV2_Feature{ uri,
const_cast<void*
>(data) });
123 result.push_back(&feature);
124 result.push_back(
nullptr);
136 bool supported =
true;
137 auto predicate = required ? node_RequiredFeature : node_OptionalFeature;
139 lilv_world_find_nodes(
gWorld, subject, predicate,
nullptr) }
141 LILV_FOREACH(nodes, i, nodes.get()) {
142 const auto node = lilv_nodes_get(nodes.get(), i);
143 const auto uri = lilv_node_as_string(node);
144 if ((strcmp(uri, LV2_UI__noUserResize) == 0) ||
145 (strcmp(uri, LV2_UI__fixedSize) == 0))
147 else if (strcmp(uri, LV2_WORKER__schedule) == 0) {
152 const auto end = features.end();
153 supported = (
end != std::find_if(features.begin(),
end,
154 [&](
auto &pFeature){ return pFeature &&
155 strcmp(pFeature->URI, uri) == 0; }));
157 wxLogError(
wxT(
"%s requires unsupported feature %s"),
158 lilv_node_as_string(lilv_plugin_get_uri(&
mPlug)), uri);
173 LV2_URI_Map_Callback_Data callback_data,
const char *,
const char *uri)
209 if (urid <=
static_cast<LV2_URID
>(
gURIDMap.size()))
213 if (urid <=
static_cast<LV2_URID
>(
mURIDMap.size()))
221 LV2_Log_Handle handle, LV2_URID type,
const char *fmt, ...)
235 LV2_Log_Handle handle, LV2_URID type,
const char *fmt, va_list ap)
243 long level = wxLOG_Error;
244 if (type == urid_Error)
246 else if (type == urid_Note)
248 else if (type == urid_Trace)
250 else if (type == urid_Warning)
251 level = wxLOG_Warning;
253 level = wxLOG_Message;
254 int len = wxCRT_VsnprintfA(
nullptr, 0, fmt, ap);
255 auto msg = std::make_unique<char[]>(len + 1);
256 wxCRT_VsnprintfA(msg.get(), len, fmt, ap);
257 wxString text(msg.get());
Lilv_ptr< LilvNodes, lilv_nodes_free > LilvNodesPtr
#define LV2_UI__makeResident
wxString LilvStringMove(LilvNode *node)
ComponentInterfaceSymbol pairs a persistent string identifier used internally with an optional,...
virtual ~ExtendedLV2FeaturesList()
FeaturePointers GetFeaturePointers() const override
void AddFeature(const char *uri, const void *data)
const LV2FeaturesListBase & mBaseFeatures
ExtendedLV2FeaturesList(WithBase_t, const LV2FeaturesListBase &baseFeatures)
std::vector< LV2_Feature > mFeatures
LV2FeaturesListBase(const LilvPlugin &plug)
bool CheckFeatures(const LilvNode *subject, bool required)
bool ValidateFeatures(const LilvNode *subject)
std::vector< const LV2_Feature * > FeaturePointers
Get vector of pointers to features, whose .data() can be passed to lv2.
virtual ~LV2FeaturesListBase()
virtual FeaturePointers GetFeaturePointers() const =0
~LV2FeaturesList() override
void AddFeature(const char *uri, const void *data)
const LV2_URID_Map mURIDMapFeature
LV2Symbols::URIDMap mURIDMap
Per-effect URID map allocates an ID for each URI on first lookup.
LV2_URID URID_Map(const char *uri) const
const LV2_Log_Log mLogFeature
static LV2_URID urid_map(LV2_URID_Map_Handle handle, const char *uri)
LV2FeaturesList(const LilvPlugin &plug)
const char * URID_Unmap(LV2_URID urid)
std::vector< LV2_Feature > mFeatures
const LV2_URI_Map_Feature mUriMapFeature
static uint32_t uri_to_id(LV2_URI_Map_Callback_Data callback_data, const char *map, const char *uri)
bool InitializeFeatures()
const LV2_URID_Unmap mURIDUnmapFeature
static int log_printf(LV2_Log_Handle handle, LV2_URID type, const char *fmt,...)
static const char * urid_unmap(LV2_URID_Unmap_Handle handle, LV2_URID urid)
static ComponentInterfaceSymbol GetPluginSymbol(const LilvPlugin &plug)
FeaturePointers GetFeaturePointers() const override
static int log_vprintf(LV2_Log_Handle handle, LV2_URID type, const char *fmt, va_list ap)
int LogVPrintf(LV2_URID type, const char *fmt, va_list ap)
bool SuppliesWorkerInterface() const
#define LV2_EXTERNAL_UI__Widget
LV2_URID Lookup_URI(URIDMap &map, const char *uri, bool add)
URIDMap gURIDMap
Declare the global map of positive integers to URIs.
const char * end(const char *str) noexcept