Browse Source

Skip some unnecessary plugin scanning steps

Signed-off-by: falkTX <falktx@falktx.com>
pull/1658/merge
falkTX 2 years ago
parent
commit
f7dda0396a
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
3 changed files with 113 additions and 16 deletions
  1. +1
    -1
      resources/ui/carla_settings.ui
  2. +83
    -3
      source/backend/utils/PluginDiscovery.cpp
  3. +29
    -12
      source/frontend/pluginlist/pluginlistdialog.cpp

+ 1
- 1
resources/ui/carla_settings.ui View File

@@ -1008,7 +1008,7 @@
<string>Maximum number of parameters to allow in the built-in 'Edit' dialog</string>
</property>
<property name="maximum">
<number>1000</number>
<number>2000</number>
</property>
</widget>
</item>


+ 83
- 3
source/backend/utils/PluginDiscovery.cpp View File

@@ -111,6 +111,7 @@ public:
fDiscoveryCallback(discoveryCb),
fCheckCacheCallback(checkCacheCb),
fCallbackPtr(callbackPtr),
fPluginPath(nullptr),
fPluginsFoundInBinary(false),
fBinaryIndex(0),
fBinaryCount(static_cast<uint>(binaries.size())),
@@ -129,12 +130,14 @@ public:
const PluginType ptype,
const CarlaPluginDiscoveryCallback discoveryCb,
const CarlaPluginCheckCacheCallback checkCacheCb,
void* const callbackPtr)
void* const callbackPtr,
const char* const pluginPath = nullptr)
: fBinaryType(btype),
fPluginType(ptype),
fDiscoveryCallback(discoveryCb),
fCheckCacheCallback(checkCacheCb),
fCallbackPtr(callbackPtr),
fPluginPath(pluginPath != nullptr ? carla_strdup_safe(pluginPath) : nullptr),
fPluginsFoundInBinary(false),
fBinaryIndex(0),
fBinaryCount(1),
@@ -153,6 +156,7 @@ public:
std::free(fNextLabel);
std::free(fNextMaker);
std::free(fNextName);
delete[] fPluginPath;
}

bool idle()
@@ -385,6 +389,7 @@ private:
const CarlaPluginDiscoveryCallback fDiscoveryCallback;
const CarlaPluginCheckCacheCallback fCheckCacheCallback;
void* const fCallbackPtr;
const char* fPluginPath;

bool fPluginsFoundInBinary;
uint fBinaryIndex;
@@ -469,6 +474,66 @@ private:

if (fBinaries.empty())
{
if (fBinaryType == CB::BINARY_NATIVE)
{
switch (fPluginType)
{
default:
break;
case CB::PLUGIN_INTERNAL:
case CB::PLUGIN_LV2:
case CB::PLUGIN_JSFX:
case CB::PLUGIN_SFZ:
if (const uint count = carla_get_cached_plugin_count(fPluginType, fPluginPath))
{
for (uint i=0; i<count; ++i)
{
const CarlaCachedPluginInfo* const pinfo = carla_get_cached_plugin_info(fPluginType, i);

if (pinfo == nullptr || !pinfo->valid)
continue;

char* filename = nullptr;
CarlaPluginDiscoveryInfo info = {};
info.btype = CB::BINARY_NATIVE;
info.ptype = fPluginType;
info.metadata.name = pinfo->name;
info.metadata.maker = pinfo->maker;
info.metadata.category = pinfo->category;
info.metadata.hints = pinfo->hints;
info.io.audioIns = pinfo->audioIns;
info.io.audioOuts = pinfo->audioOuts;
info.io.cvIns = pinfo->cvIns;
info.io.cvOuts = pinfo->cvOuts;
info.io.midiIns = pinfo->midiIns;
info.io.midiOuts = pinfo->midiOuts;
info.io.parameterIns = pinfo->parameterIns;
info.io.parameterOuts = pinfo->parameterOuts;

if (fPluginType == CB::PLUGIN_LV2)
{
const char* const slash = std::strchr(pinfo->label, CARLA_OS_SEP);
CARLA_SAFE_ASSERT_BREAK(slash != nullptr);
filename = strdup(pinfo->label);
filename[slash - pinfo->label] = '\0';
info.filename = filename;
info.label = slash + 1;
}
else
{
info.filename = gPluginsDiscoveryNullCharPtr;
info.label = pinfo->label;
}

fDiscoveryCallback(fCallbackPtr, &info, nullptr);

std::free(filename);
}
}
return;
}
}

#ifndef CARLA_OS_WIN
if (helperTool.isNotEmpty())
startPipeServer(helperTool.toRawUTF8(), fDiscoveryTool, getPluginTypeAsString(fPluginType), ":all");
@@ -664,6 +729,21 @@ CarlaPluginDiscoveryHandle carla_plugin_discovery_start(const char* const discov
bool directories = false;
const char* wildcard = nullptr;

switch (ptype)
{
case CB::PLUGIN_INTERNAL:
case CB::PLUGIN_LV2:
case CB::PLUGIN_SFZ:
case CB::PLUGIN_JSFX:
case CB::PLUGIN_DLS:
case CB::PLUGIN_GIG:
case CB::PLUGIN_SF2:
CARLA_SAFE_ASSERT_UINT_RETURN(btype == CB::BINARY_NATIVE, btype, nullptr);
break;
default:
break;
}

switch (ptype)
{
case CB::PLUGIN_NONE:
@@ -671,15 +751,15 @@ CarlaPluginDiscoveryHandle carla_plugin_discovery_start(const char* const discov
case CB::PLUGIN_TYPE_COUNT:
return nullptr;

case CB::PLUGIN_LV2:
case CB::PLUGIN_SFZ:
case CB::PLUGIN_JSFX:
{
const CarlaScopedEnvVar csev("CARLA_DISCOVERY_PATH", pluginPath);
return new CarlaPluginDiscovery(discoveryTool, btype, ptype, discoveryCb, checkCacheCb, callbackPtr);
return new CarlaPluginDiscovery(discoveryTool, btype, ptype, discoveryCb, checkCacheCb, callbackPtr, pluginPath);
}

case CB::PLUGIN_INTERNAL:
case CB::PLUGIN_LV2:
case CB::PLUGIN_AU:
return new CarlaPluginDiscovery(discoveryTool, btype, ptype, discoveryCb, checkCacheCb, callbackPtr);



+ 29
- 12
source/frontend/pluginlist/pluginlistdialog.cpp View File

@@ -696,7 +696,7 @@ struct PluginListDialog::PrivateData {
if (btype == BINARY_NATIVE)
{
btype = BINARY_WIN32;
ptype = PLUGIN_INTERNAL;
ptype = PLUGIN_NONE;
tool = carla_get_library_folder();
tool += CARLA_OS_SEP_STR "carla-discovery-win32.exe";

@@ -714,7 +714,7 @@ struct PluginListDialog::PrivateData {
if (btype == BINARY_NATIVE)
{
btype = BINARY_POSIX32;
ptype = PLUGIN_INTERNAL;
ptype = PLUGIN_NONE;
tool = carla_get_library_folder();
tool += CARLA_OS_SEP_STR "carla-discovery-posix32";

@@ -731,7 +731,7 @@ struct PluginListDialog::PrivateData {
if (btype == BINARY_NATIVE || btype == BINARY_POSIX32)
{
btype = BINARY_WIN64;
ptype = PLUGIN_INTERNAL;
ptype = PLUGIN_NONE;
tool = carla_get_library_folder();
tool += CARLA_OS_SEP_STR "carla-discovery-win64.exe";

@@ -743,7 +743,7 @@ struct PluginListDialog::PrivateData {
if (btype != BINARY_WIN32)
{
btype = BINARY_WIN32;
ptype = PLUGIN_INTERNAL;
ptype = PLUGIN_NONE;
tool = carla_get_library_folder();
tool += CARLA_OS_SEP_STR "carla-discovery-win32.exe";

@@ -1221,10 +1221,14 @@ void PluginListDialog::timerEvent(QTimerEvent* const event)
break;
case PLUGIN_DSSI:
#endif
ui.label->setText(tr("Discovering LV2 plugins..."));
path = p->paths.lv2;
p->discovery.ptype = PLUGIN_LV2;
break;
if (p->discovery.btype == BINARY_NATIVE && p->paths.lv2.isNotEmpty())
{
ui.label->setText(tr("Discovering LV2 plugins..."));
path = p->paths.lv2;
p->discovery.ptype = PLUGIN_LV2;
break;
}
[[fallthrough]];
case PLUGIN_LV2:
ui.label->setText(tr("Discovering VST2 plugins..."));
path = p->paths.vst2;
@@ -1281,11 +1285,24 @@ void PluginListDialog::timerEvent(QTimerEvent* const event)
case PLUGIN_SFZ:
#endif
default:
// discovery complete
#ifndef CARLA_FRONTEND_ONLY_EMBEDDABLE_PLUGINS
if (! p->discovery.nextTool())
#endif
// discovery complete?
for (;;)
{
#ifndef CARLA_FRONTEND_ONLY_EMBEDDABLE_PLUGINS
if (p->discovery.nextTool())
{
// tool has nothing to search, go to next one
if (p->discovery.ptype == PLUGIN_NONE)
continue;

// there is still to do, break out of loop
break;
}
#endif

refreshPluginsStop();
break;
}
}

if (p->timerId == 0)


Loading…
Cancel
Save