Browse Source

Add 'valid' field to CarlaCachedPluginInfo; Fix build

tags/v1.9.11
falkTX 6 years ago
parent
commit
81e36929d0
5 changed files with 45 additions and 13 deletions
  1. +8
    -0
      source/backend/CarlaUtils.h
  2. +18
    -2
      source/backend/utils/CachedPlugins.cpp
  3. +7
    -0
      source/carla_utils.py
  4. +11
    -11
      source/discovery/carla-discovery.cpp
  5. +1
    -0
      source/rest/carla-utils.cpp

+ 8
- 0
source/backend/CarlaUtils.h View File

@@ -49,6 +49,14 @@ typedef void (*CarlaPipeCallbackFunc)(void* ptr, const char* msg);
* @see carla_get_cached_plugin_info() * @see carla_get_cached_plugin_info()
*/ */
typedef struct _CarlaCachedPluginInfo { 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. * Plugin category.
*/ */


+ 18
- 2
source/backend/utils/CachedPlugins.cpp View File

@@ -25,10 +25,23 @@ namespace CB = CarlaBackend;


static const char* const gNullCharPtr = ""; 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 _CarlaCachedPluginInfo::_CarlaCachedPluginInfo() noexcept
: category(CB::PLUGIN_CATEGORY_NONE),
: valid(false),
category(CB::PLUGIN_CATEGORY_NONE),
hints(0x0), hints(0x0),
audioIns(0), audioIns(0),
audioOuts(0), audioOuts(0),
@@ -45,7 +58,7 @@ _CarlaCachedPluginInfo::_CarlaCachedPluginInfo() noexcept


uint carla_get_cached_plugin_count(CB::PluginType ptype, const char* pluginPath) 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)); carla_debug("carla_get_cached_plugin_count(%i:%s)", ptype, CB::PluginType2Str(ptype));


switch (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) if (desc.hints & NATIVE_PLUGIN_USES_MULTI_PROGS)
info.hints |= CB::PLUGIN_USES_MULTI_PROGS; info.hints |= CB::PLUGIN_USES_MULTI_PROGS;


info.valid = true;
info.audioIns = desc.audioIns; info.audioIns = desc.audioIns;
info.audioOuts = desc.audioOuts; info.audioOuts = desc.audioOuts;
info.midiIns = desc.midiIns; 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)); lilv_nodes_free(const_cast<LilvNodes*>(licenseNodes.me));


info.valid = true;
info.name = sname; info.name = sname;
info.label = suri; info.label = suri;
info.maker = smaker; info.maker = smaker;
@@ -394,6 +409,7 @@ const CarlaCachedPluginInfo* carla_get_cached_plugin_info(CB::PluginType ptype,
break; break;
} }


info.valid = true;
info.category = CB::PLUGIN_CATEGORY_NONE; info.category = CB::PLUGIN_CATEGORY_NONE;
info.hints = 0x0; info.hints = 0x0;
info.audioIns = 0; info.audioIns = 0;


+ 7
- 0
source/carla_utils.py View File

@@ -90,6 +90,12 @@ CarlaPipeCallbackFunc = CFUNCTYPE(None, c_void_p, c_char_p)
# @see carla_get_cached_plugin_info() # @see carla_get_cached_plugin_info()
class CarlaCachedPluginInfo(Structure): class CarlaCachedPluginInfo(Structure):
_fields_ = [ _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. # Plugin category.
("category", c_enum), ("category", c_enum),


@@ -133,6 +139,7 @@ class CarlaCachedPluginInfo(Structure):


# @see CarlaCachedPluginInfo # @see CarlaCachedPluginInfo
PyCarlaCachedPluginInfo = { PyCarlaCachedPluginInfo = {
'valid': False,
'category': PLUGIN_CATEGORY_NONE, 'category': PLUGIN_CATEGORY_NONE,
'hints': 0x0, 'hints': 0x0,
'audioIns': 0, 'audioIns': 0,


+ 11
- 11
source/discovery/carla-discovery.cpp View File

@@ -44,8 +44,7 @@
#include "water/text/StringArray.h" #include "water/text/StringArray.h"


#ifndef BUILD_BRIDGE #ifndef BUILD_BRIDGE
# define CARLA_UTILS_CACHED_PLUGINS_ONLY
# include "CarlaUtils.cpp"
# include "../backend/utils/CachedPlugins.cpp"
#endif #endif


#define DISCOVERY_OUT(x, y) std::cout << "\ncarla-discovery::" << x << "::" << y << std::endl; #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)); const CarlaCachedPluginInfo* pinfo(carla_get_cached_plugin_info(type, i));
CARLA_SAFE_ASSERT_CONTINUE(pinfo != nullptr); CARLA_SAFE_ASSERT_CONTINUE(pinfo != nullptr);


if (! pinfo->valid)
continue;

DISCOVERY_OUT("init", "-----------"); DISCOVERY_OUT("init", "-----------");
DISCOVERY_OUT("build", BINARY_NATIVE); DISCOVERY_OUT("build", BINARY_NATIVE);
DISCOVERY_OUT("hints", pinfo->hints); DISCOVERY_OUT("hints", pinfo->hints);
@@ -1476,18 +1478,16 @@ int main(int argc, char* argv[])
break; 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 #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 #endif
}


if (openLib) if (openLib)
{ {


+ 1
- 0
source/rest/carla-utils.cpp View File

@@ -68,6 +68,7 @@ void handle_carla_get_cached_plugin_info(const std::shared_ptr<Session> session)


char* jsonBuf; char* jsonBuf;
jsonBuf = json_buf_start(); 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, "category", info->category);
jsonBuf = json_buf_add_uint(jsonBuf, "hints", info->hints); jsonBuf = json_buf_add_uint(jsonBuf, "hints", info->hints);
jsonBuf = json_buf_add_uint(jsonBuf, "audioIns", info->audioIns); jsonBuf = json_buf_add_uint(jsonBuf, "audioIns", info->audioIns);


Loading…
Cancel
Save