19#pragma GCC diagnostic ignored "-Wparentheses"
20#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
21#elif defined(__clang__)
22#pragma clang diagnostic ignored "-Wparentheses"
23#pragma clang diagnostic ignored "-Wdeprecated-declarations"
29#include "lv2/buf-size/buf-size.h"
31#include "lv2/worker/worker.h"
34 , mSuppliesWorkerInterface{ SuppliesWorkerInterface(plug) }
59 lilv_plugin_get_uri(&
mPlug), node_MinBlockLength,
nullptr) }
60 ; lilv_node_is_int(minLength.get())
62 if (
auto value = lilv_node_as_int(minLength.get())
68 lilv_plugin_get_uri(&
mPlug), node_MaxBlockLength,
nullptr) }
69 ; lilv_node_is_int(maxLength.get())
71 if (
auto value = lilv_node_as_int(maxLength.get())
89 AddFeature(LV2_BUF_SIZE__boundedBlockLength,
nullptr);
90 AddFeature(LV2_BUF_SIZE__fixedBlockLength,
nullptr);
106 if (
LilvNodesPtr extdata{ lilv_plugin_get_extension_data(&plug) }) {
107 LILV_FOREACH(nodes, i, extdata.get()) {
108 const auto node = lilv_nodes_get(extdata.get(), i);
109 const auto uri = lilv_node_as_string(node);
110 if (strcmp(uri, LV2_WORKER__interface) == 0)
118 LV2_URID
key, uint32_t
size, LV2_URID type,
const void *value)
122 mOptions.emplace_back(LV2_Options_Option{
123 LV2_OPTIONS_INSTANCE, 0,
key,
size, type, value });
125 mOptions.emplace_back(LV2_Options_Option{});
134 mFeatures.emplace_back(LV2_Feature{ uri,
const_cast<void*
>(data) });
141 result.push_back(&feature);
142 result.push_back(
nullptr);
162 bool supported =
true;
163 auto predicate = required ? node_RequiredFeature : node_OptionalFeature;
165 lilv_world_find_nodes(
gWorld, subject, predicate,
nullptr) }) {
166 LILV_FOREACH(nodes, i, nodes.get()) {
167 const auto node = lilv_nodes_get(nodes.get(), i);
168 const auto uri = lilv_node_as_string(node);
169 if ((strcmp(uri, LV2_UI__noUserResize) == 0) ||
170 (strcmp(uri, LV2_UI__fixedSize) == 0))
172 else if (strcmp(uri, LV2_WORKER__schedule) == 0) {
178 [&](
auto &feature){ return strcmp(feature.URI, uri) == 0; }));
180 wxLogError(wxT(
"%s requires unsupported feature %s"),
181 lilv_node_as_string(lilv_plugin_get_uri(&
mPlug)), uri);
198 bool supported =
true;
199 const auto predicate =
200 required ? node_RequiredOption : node_SupportedOption;
202 lilv_world_find_nodes(
gWorld, subject, predicate,
nullptr) }) {
203 LILV_FOREACH(nodes, i, nodes.get()) {
204 const auto node = lilv_nodes_get(nodes.get(), i);
205 const auto uri = lilv_node_as_string(node);
207 if (urid == urid_NominalBlockLength)
214 [&](
const auto &option){ return option.key == urid; }));
216 wxLogError(wxT(
"%s requires unsupported option %s"),
217 lilv_node_as_string(lilv_plugin_get_uri(&
mPlug)), uri);
232 LV2_URI_Map_Callback_Data callback_data,
const char *,
const char *uri)
268 if (urid <=
static_cast<LV2_URID
>(
gURIDMap.size()))
272 if (urid <=
static_cast<LV2_URID
>(
mURIDMap.size()))
280 LV2_Log_Handle handle, LV2_URID type,
const char *fmt, ...)
294 LV2_Log_Handle handle, LV2_URID type,
const char *fmt, va_list ap)
302 long level = wxLOG_Error;
303 if (type == urid_Error)
305 else if (type == urid_Note)
307 else if (type == urid_Trace)
309 else if (type == urid_Warning)
310 level = wxLOG_Warning;
312 level = wxLOG_Message;
313 int len = wxCRT_VsnprintfA(
nullptr, 0, fmt, ap);
314 auto msg = std::make_unique<char[]>(len + 1);
315 wxCRT_VsnprintfA(msg.get(), len, fmt, ap);
316 wxString text(msg.get());
318 wxT(
"%s: %s"),
GetSymbol().Msgid().Translation(), text);
static const AudacityProject::AttachedObjects::RegisteredFactory key
Lilv_ptr< LilvNodes, lilv_nodes_free > LilvNodesPtr
#define LV2_UI__makeResident
Lilv_ptr< LilvNode, lilv_node_free > LilvNodePtr
ComponentInterfaceSymbol GetSymbol() const override
void AddFeature(const char *uri, const void *data)
const LV2_URID_Map mURIDMapFeature
LV2Symbols::URIDMap mURIDMap
LV2_URID URID_Map(const char *uri)
const LV2_Log_Log mLogFeature
static LV2_URID urid_map(LV2_URID_Map_Handle handle, const char *uri)
LV2FeaturesList(const LilvPlugin &plug)
const LV2_Options_Option * NominalBlockLengthOption() const
const char * URID_Unmap(LV2_URID urid)
std::vector< LV2_Feature > mFeatures
FeaturePointers GetFeaturePointers() const
std::vector< LV2_Options_Option > mOptions
const LV2_URI_Map_Feature mUriMapFeature
size_t AddOption(LV2_URID, uint32_t size, LV2_URID, const void *value)
static uint32_t uri_to_id(LV2_URI_Map_Callback_Data callback_data, const char *map, const char *uri)
bool mSupportsNominalBlockLength
bool InitializeFeatures()
const LV2_URID_Unmap mURIDUnmapFeature
static int log_printf(LV2_Log_Handle handle, LV2_URID type, const char *fmt,...)
bool CheckOptions(const LilvNode *subject, bool required)
static const char * urid_unmap(LV2_URID_Unmap_Handle handle, LV2_URID urid)
std::vector< const LV2_Feature * > FeaturePointers
Get vector of pointers to features, whose .data() can be passed to lv2.
bool ValidateOptions(const LilvNode *subject)
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 CheckFeatures(const LilvNode *subject, bool required)
bool SuppliesWorkerInterface() const
bool ValidateFeatures(const LilvNode *subject)
#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.
auto end(const Ptr< Type, BaseDeleter > &p)
Enables range-for.