@@ -49,6 +49,14 @@ typedef void (*CarlaPipeCallbackFunc)(void* ptr, const char* msg); | |||
* @see carla_get_cached_plugin_info() | |||
*/ | |||
typedef struct _CarlaCachedPluginInfo { | |||
/*! | |||
* Wherever the data in this struct is valid. | |||
* For performance reasons, plugins are only checked on request, | |||
* and as such, the count vs number of really valid plugins might not match. | |||
* Use this field to skip on plugins which cannot be loaded in Carla. | |||
*/ | |||
bool valid; | |||
/*! | |||
* Plugin category. | |||
*/ | |||
@@ -25,10 +25,23 @@ namespace CB = CarlaBackend; | |||
static const char* const gNullCharPtr = ""; | |||
static bool isCachedPluginType(const CB::PluginType ptype) | |||
{ | |||
switch (ptype) | |||
{ | |||
case CB::PLUGIN_INTERNAL: | |||
case CB::PLUGIN_LV2: | |||
return false; | |||
default: | |||
return true; | |||
} | |||
} | |||
// ------------------------------------------------------------------------------------------------------------------- | |||
_CarlaCachedPluginInfo::_CarlaCachedPluginInfo() noexcept | |||
: category(CB::PLUGIN_CATEGORY_NONE), | |||
: valid(false), | |||
category(CB::PLUGIN_CATEGORY_NONE), | |||
hints(0x0), | |||
audioIns(0), | |||
audioOuts(0), | |||
@@ -45,7 +58,7 @@ _CarlaCachedPluginInfo::_CarlaCachedPluginInfo() noexcept | |||
uint carla_get_cached_plugin_count(CB::PluginType ptype, const char* pluginPath) | |||
{ | |||
CARLA_SAFE_ASSERT_RETURN(ptype == CB::PLUGIN_INTERNAL || ptype == CB::PLUGIN_LV2, 0); | |||
CARLA_SAFE_ASSERT_RETURN(isCachedPluginType(ptype), 0); | |||
carla_debug("carla_get_cached_plugin_count(%i:%s)", ptype, CB::PluginType2Str(ptype)); | |||
switch (ptype) | |||
@@ -99,6 +112,7 @@ const CarlaCachedPluginInfo* carla_get_cached_plugin_info(CB::PluginType ptype, | |||
if (desc.hints & NATIVE_PLUGIN_USES_MULTI_PROGS) | |||
info.hints |= CB::PLUGIN_USES_MULTI_PROGS; | |||
info.valid = true; | |||
info.audioIns = desc.audioIns; | |||
info.audioOuts = desc.audioOuts; | |||
info.midiIns = desc.midiIns; | |||
@@ -382,6 +396,7 @@ const CarlaCachedPluginInfo* carla_get_cached_plugin_info(CB::PluginType ptype, | |||
lilv_nodes_free(const_cast<LilvNodes*>(licenseNodes.me)); | |||
info.valid = true; | |||
info.name = sname; | |||
info.label = suri; | |||
info.maker = smaker; | |||
@@ -394,6 +409,7 @@ const CarlaCachedPluginInfo* carla_get_cached_plugin_info(CB::PluginType ptype, | |||
break; | |||
} | |||
info.valid = true; | |||
info.category = CB::PLUGIN_CATEGORY_NONE; | |||
info.hints = 0x0; | |||
info.audioIns = 0; | |||
@@ -90,6 +90,12 @@ CarlaPipeCallbackFunc = CFUNCTYPE(None, c_void_p, c_char_p) | |||
# @see carla_get_cached_plugin_info() | |||
class CarlaCachedPluginInfo(Structure): | |||
_fields_ = [ | |||
# Wherever the data in this struct is valid. | |||
# For performance reasons, plugins are only checked on request, | |||
# and as such, the count vs number of really valid plugins might not match. | |||
# Use this field to skip on plugins which cannot be loaded in Carla. | |||
("valid", c_bool), | |||
# Plugin category. | |||
("category", c_enum), | |||
@@ -133,6 +139,7 @@ class CarlaCachedPluginInfo(Structure): | |||
# @see CarlaCachedPluginInfo | |||
PyCarlaCachedPluginInfo = { | |||
'valid': False, | |||
'category': PLUGIN_CATEGORY_NONE, | |||
'hints': 0x0, | |||
'audioIns': 0, | |||
@@ -44,8 +44,7 @@ | |||
#include "water/text/StringArray.h" | |||
#ifndef BUILD_BRIDGE | |||
# define CARLA_UTILS_CACHED_PLUGINS_ONLY | |||
# include "CarlaUtils.cpp" | |||
# include "../backend/utils/CachedPlugins.cpp" | |||
#endif | |||
#define DISCOVERY_OUT(x, y) std::cout << "\ncarla-discovery::" << x << "::" << y << std::endl; | |||
@@ -280,6 +279,9 @@ static void do_cached_check(const PluginType type) | |||
const CarlaCachedPluginInfo* pinfo(carla_get_cached_plugin_info(type, i)); | |||
CARLA_SAFE_ASSERT_CONTINUE(pinfo != nullptr); | |||
if (! pinfo->valid) | |||
continue; | |||
DISCOVERY_OUT("init", "-----------"); | |||
DISCOVERY_OUT("build", BINARY_NATIVE); | |||
DISCOVERY_OUT("hints", pinfo->hints); | |||
@@ -1476,18 +1478,16 @@ int main(int argc, char* argv[]) | |||
break; | |||
} | |||
if (type != PLUGIN_SF2 && type != PLUGIN_SFZ) | |||
if (type != PLUGIN_SF2 && filenameCheck.contains("fluidsynth", true)) | |||
{ | |||
if (filenameCheck.contains("fluidsynth", true)) | |||
{ | |||
DISCOVERY_OUT("info", "skipping fluidsynth based plugin"); | |||
return 0; | |||
} | |||
DISCOVERY_OUT("info", "skipping fluidsynth based plugin"); | |||
return 0; | |||
} | |||
#ifdef CARLA_OS_MAC | |||
if (type == PLUGIN_VST2 && (filenameCheck.endsWith(".vst") || filenameCheck.endsWith(".vst/"))) | |||
openLib = false; | |||
if (type == PLUGIN_VST2 && (filenameCheck.endsWith(".vst") || filenameCheck.endsWith(".vst/"))) | |||
openLib = false; | |||
#endif | |||
} | |||
if (openLib) | |||
{ | |||
@@ -68,6 +68,7 @@ void handle_carla_get_cached_plugin_info(const std::shared_ptr<Session> session) | |||
char* jsonBuf; | |||
jsonBuf = json_buf_start(); | |||
jsonBuf = json_buf_add_bool(jsonBuf, "valid", info->valid); | |||
jsonBuf = json_buf_add_uint(jsonBuf, "category", info->category); | |||
jsonBuf = json_buf_add_uint(jsonBuf, "hints", info->hints); | |||
jsonBuf = json_buf_add_uint(jsonBuf, "audioIns", info->audioIns); | |||