Experiment with Ildaeil plugin scanning on main thread, for AU
This commit is contained in:
parent
46c333a0fe
commit
4c4c3ae135
3 changed files with 91 additions and 72 deletions
9
Makefile
9
Makefile
|
@ -22,9 +22,12 @@ CARLA_EXTRA_ARGS = \
|
|||
HAVE_FFMPEG=false \
|
||||
HAVE_FLUIDSYNTH=false \
|
||||
HAVE_LIBMAGIC=false \
|
||||
HAVE_SNDFILE=false \
|
||||
USING_JUCE=false \
|
||||
USING_JUCE_GUI_EXTRA=false
|
||||
HAVE_SNDFILE=false
|
||||
|
||||
ifneq ($(MACOS),true)
|
||||
CARLA_EXTRA_ARGS += USING_JUCE=false
|
||||
CARLA_EXTRA_ARGS += USING_JUCE_GUI_EXTRA=false
|
||||
endif
|
||||
|
||||
# --------------------------------------------------------------
|
||||
# Check for system-wide dependencies
|
||||
|
|
|
@ -553,7 +553,7 @@ static intptr_t host_dispatcher(const NativeHostHandle handle, const NativeHostD
|
|||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
#ifndef HEADLESS
|
||||
struct IldaeilWidget : ImGuiWidget, IdleCallback, Thread {
|
||||
struct IldaeilWidget : ImGuiWidget, IdleCallback /* , Thread */ {
|
||||
static constexpr const uint kButtonHeight = 20;
|
||||
|
||||
struct PluginInfoCache {
|
||||
|
@ -631,12 +631,15 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Thread {
|
|||
kIdleHidePluginUI,
|
||||
kIdleGiveIdleToUI,
|
||||
kIdleChangePluginType,
|
||||
kIdlePluginScanning,
|
||||
kIdleNothing
|
||||
} fIdleState = kIdleInit;
|
||||
|
||||
PluginType fPluginType = PLUGIN_LV2;
|
||||
PluginType fNextPluginType = fPluginType;
|
||||
uint fPluginCount = 0;
|
||||
uint fPluginScanStep = 0;
|
||||
uint fPluginScanMax = 0;
|
||||
int fPluginSelected = -1;
|
||||
bool fPluginScanningFinished = false;
|
||||
bool fPluginHasCustomUI = false;
|
||||
|
@ -700,9 +703,6 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Thread {
|
|||
module->fUI = nullptr;
|
||||
}
|
||||
|
||||
if (isThreadRunning())
|
||||
stopThread(-1);
|
||||
|
||||
fPluginGenericUI = nullptr;
|
||||
|
||||
delete[] fPlugins;
|
||||
|
@ -935,7 +935,10 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Thread {
|
|||
carla_set_engine_option(handle, ENGINE_OPTION_FRONTEND_UI_SCALE, pcontext->window->pixelRatio*1000, nullptr);
|
||||
|
||||
if (! idleCallbackActive)
|
||||
{
|
||||
carla_juce_init();
|
||||
idleCallbackActive = pcontext->addIdleCallback(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -952,6 +955,7 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Thread {
|
|||
{
|
||||
idleCallbackActive = false;
|
||||
pcontext->removeIdleCallback(this);
|
||||
carla_juce_cleanup();
|
||||
|
||||
if (fileBrowserHandle != nullptr)
|
||||
{
|
||||
|
@ -967,6 +971,8 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Thread {
|
|||
const CarlaHostHandle handle = module->fCarlaHostHandle;
|
||||
DISTRHO_SAFE_ASSERT_RETURN(handle != nullptr,);
|
||||
|
||||
carla_juce_idle();
|
||||
|
||||
if (fileBrowserHandle != nullptr && fileBrowserIdle(fileBrowserHandle))
|
||||
{
|
||||
if (const char* const path = fileBrowserGetPath(fileBrowserHandle))
|
||||
|
@ -985,14 +991,12 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Thread {
|
|||
switch (fIdleState)
|
||||
{
|
||||
case kIdleInit:
|
||||
fIdleState = kIdleNothing;
|
||||
startThread();
|
||||
scanStart();
|
||||
break;
|
||||
|
||||
case kIdleInitPluginAlreadyLoaded:
|
||||
fIdleState = kIdleNothing;
|
||||
createOrUpdatePluginGenericUI(handle);
|
||||
startThread();
|
||||
scanStart();
|
||||
break;
|
||||
|
||||
case kIdlePluginLoadedFromDSP:
|
||||
|
@ -1025,12 +1029,13 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Thread {
|
|||
break;
|
||||
|
||||
case kIdleChangePluginType:
|
||||
fIdleState = kIdleNothing;
|
||||
fPluginSelected = -1;
|
||||
if (isThreadRunning())
|
||||
stopThread(-1);
|
||||
fPluginType = fNextPluginType;
|
||||
startThread();
|
||||
scanStart();
|
||||
break;
|
||||
|
||||
case kIdlePluginScanning:
|
||||
scanStep();
|
||||
break;
|
||||
|
||||
case kIdleNothing:
|
||||
|
@ -1049,6 +1054,7 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Thread {
|
|||
switch (fPluginType)
|
||||
{
|
||||
case PLUGIN_INTERNAL:
|
||||
case PLUGIN_AU:
|
||||
// case PLUGIN_JSFX:
|
||||
case PLUGIN_SFZ:
|
||||
label = info.label;
|
||||
|
@ -1077,12 +1083,10 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Thread {
|
|||
}
|
||||
*/
|
||||
|
||||
void run() override
|
||||
void scanStart()
|
||||
{
|
||||
const PluginType pluginType = fPluginType;
|
||||
const char* path;
|
||||
|
||||
switch (pluginType)
|
||||
switch (fPluginType)
|
||||
{
|
||||
case PLUGIN_LV2:
|
||||
path = std::getenv("LV2_PATH");
|
||||
|
@ -1093,50 +1097,63 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Thread {
|
|||
}
|
||||
|
||||
if (path != nullptr)
|
||||
carla_set_engine_option(module->fCarlaHostHandle, ENGINE_OPTION_PLUGIN_PATH, pluginType, path);
|
||||
carla_set_engine_option(module->fCarlaHostHandle, ENGINE_OPTION_PLUGIN_PATH, fPluginType, path);
|
||||
|
||||
const MutexLocker cml(sPluginInfoLoadMutex);
|
||||
fPluginCount = fPluginScanStep = 0;
|
||||
|
||||
if (const uint count = carla_get_cached_plugin_count(pluginType, path))
|
||||
{
|
||||
fPluginCount = 0;
|
||||
fPlugins = new PluginInfoCache[count];
|
||||
|
||||
if (fDrawingState == kDrawingLoading)
|
||||
{
|
||||
fDrawingState = kDrawingPluginList;
|
||||
fPluginSearchFirstShow = true;
|
||||
}
|
||||
|
||||
for (uint i=0, j; i < count && ! shouldThreadExit(); ++i)
|
||||
{
|
||||
const CarlaCachedPluginInfo* const info = carla_get_cached_plugin_info(pluginType, i);
|
||||
DISTRHO_SAFE_ASSERT_CONTINUE(info != nullptr);
|
||||
|
||||
if (! info->valid)
|
||||
continue;
|
||||
if (info->audioIns != 0 && info->audioIns != 2)
|
||||
continue;
|
||||
if (info->audioOuts > 2)
|
||||
continue;
|
||||
|
||||
j = fPluginCount;
|
||||
fPlugins[j].name = strdup(info->name);
|
||||
fPlugins[j].label = strdup(info->label);
|
||||
++fPluginCount;
|
||||
}
|
||||
}
|
||||
else if (fDrawingState == kDrawingLoading)
|
||||
{
|
||||
String error("There are no ");
|
||||
error += getPluginTypeAsString(pluginType);
|
||||
error += " audio plugins on this system.";
|
||||
fPopupError = error;
|
||||
fDrawingState = kDrawingErrorInit;
|
||||
const MutexLocker cml(sPluginInfoLoadMutex);
|
||||
fPluginScanMax = carla_get_cached_plugin_count(fPluginType, path);
|
||||
}
|
||||
|
||||
if (! shouldThreadExit())
|
||||
delete[] fPlugins;
|
||||
|
||||
if (fPluginScanMax != 0)
|
||||
{
|
||||
fPlugins = new PluginInfoCache[fPluginScanMax];
|
||||
fIdleState = kIdlePluginScanning;
|
||||
}
|
||||
else
|
||||
{
|
||||
fPlugins = nullptr;
|
||||
fPluginScanningFinished = true;
|
||||
fIdleState = kIdleNothing;
|
||||
}
|
||||
|
||||
if (fDrawingState == kDrawingLoading)
|
||||
{
|
||||
fDrawingState = kDrawingPluginList;
|
||||
fPluginSearchFirstShow = true;
|
||||
}
|
||||
}
|
||||
|
||||
void scanStep()
|
||||
{
|
||||
for (uint i = 0, j; i < 10 && fPluginScanStep < fPluginScanMax; ++i, ++fPluginScanStep)
|
||||
{
|
||||
const CarlaCachedPluginInfo* info;
|
||||
{
|
||||
const MutexLocker cml(sPluginInfoLoadMutex);
|
||||
info = carla_get_cached_plugin_info(fPluginType, fPluginScanStep);
|
||||
}
|
||||
DISTRHO_SAFE_ASSERT_CONTINUE(info != nullptr);
|
||||
|
||||
if (! info->valid)
|
||||
continue;
|
||||
if (info->audioIns != 0 && info->audioIns != 2)
|
||||
continue;
|
||||
|
||||
j = fPluginCount;
|
||||
fPlugins[j].name = strdup(info->name);
|
||||
fPlugins[j].label = strdup(info->label);
|
||||
++fPluginCount;
|
||||
}
|
||||
|
||||
if (fPluginScanStep == fPluginScanMax)
|
||||
{
|
||||
fPluginScanningFinished = true;
|
||||
fIdleState = kIdleNothing;
|
||||
}
|
||||
}
|
||||
|
||||
void drawImGui() override
|
||||
|
@ -1482,6 +1499,7 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Thread {
|
|||
switch (fPluginType)
|
||||
{
|
||||
case PLUGIN_INTERNAL:
|
||||
case PLUGIN_AU:
|
||||
// case PLUGIN_JSFX:
|
||||
case PLUGIN_SFZ:
|
||||
ImGui::TableNextRow();
|
||||
|
|
|
@ -40,20 +40,18 @@ CARLA_EXTRA_LIBS += $(CARLA_BUILD_DIR)/modules/$(CARLA_BUILD_TYPE)/rtmempool.a
|
|||
CARLA_EXTRA_LIBS += $(CARLA_BUILD_DIR)/modules/$(CARLA_BUILD_TYPE)/sfzero.a
|
||||
CARLA_EXTRA_LIBS += $(CARLA_BUILD_DIR)/modules/$(CARLA_BUILD_TYPE)/water.a
|
||||
CARLA_EXTRA_LIBS += $(CARLA_BUILD_DIR)/modules/$(CARLA_BUILD_TYPE)/zita-resampler.a
|
||||
# CARLA_EXTRA_LIBS += $(CARLA_BUILD_DIR)/modules/$(CARLA_BUILD_TYPE)/eel2.a
|
||||
# CARLA_EXTRA_LIBS += $(CARLA_BUILD_DIR)/modules/$(CARLA_BUILD_TYPE)/jsusfx.a
|
||||
# # ifeq ($(USING_JUCE),true)
|
||||
# # CARLA_EXTRA_LIBS += $(CARLA_BUILD_DIR)/modules/$(CARLA_BUILD_TYPE)/juce_audio_basics.a
|
||||
# # CARLA_EXTRA_LIBS += $(CARLA_BUILD_DIR)/modules/$(CARLA_BUILD_TYPE)/juce_audio_processors.a
|
||||
# # CARLA_EXTRA_LIBS += $(CARLA_BUILD_DIR)/modules/$(CARLA_BUILD_TYPE)/juce_core.a
|
||||
# # CARLA_EXTRA_LIBS += $(CARLA_BUILD_DIR)/modules/$(CARLA_BUILD_TYPE)/juce_data_structures.a
|
||||
# # CARLA_EXTRA_LIBS += $(CARLA_BUILD_DIR)/modules/$(CARLA_BUILD_TYPE)/juce_events.a
|
||||
# # CARLA_EXTRA_LIBS += $(CARLA_BUILD_DIR)/modules/$(CARLA_BUILD_TYPE)/juce_graphics.a
|
||||
# # CARLA_EXTRA_LIBS += $(CARLA_BUILD_DIR)/modules/$(CARLA_BUILD_TYPE)/juce_gui_basics.a
|
||||
# # ifeq ($(USING_JUCE_GUI_EXTRA),true)
|
||||
# # CARLA_EXTRA_LIBS += $(CARLA_BUILD_DIR)/modules/$(CARLA_BUILD_TYPE)/juce_gui_extra.a
|
||||
# # endif
|
||||
# # endif
|
||||
ifeq ($(USING_JUCE),true)
|
||||
CARLA_EXTRA_LIBS += $(CARLA_BUILD_DIR)/modules/$(CARLA_BUILD_TYPE)/juce_audio_basics.a
|
||||
CARLA_EXTRA_LIBS += $(CARLA_BUILD_DIR)/modules/$(CARLA_BUILD_TYPE)/juce_audio_processors.a
|
||||
CARLA_EXTRA_LIBS += $(CARLA_BUILD_DIR)/modules/$(CARLA_BUILD_TYPE)/juce_core.a
|
||||
CARLA_EXTRA_LIBS += $(CARLA_BUILD_DIR)/modules/$(CARLA_BUILD_TYPE)/juce_data_structures.a
|
||||
CARLA_EXTRA_LIBS += $(CARLA_BUILD_DIR)/modules/$(CARLA_BUILD_TYPE)/juce_events.a
|
||||
CARLA_EXTRA_LIBS += $(CARLA_BUILD_DIR)/modules/$(CARLA_BUILD_TYPE)/juce_graphics.a
|
||||
CARLA_EXTRA_LIBS += $(CARLA_BUILD_DIR)/modules/$(CARLA_BUILD_TYPE)/juce_gui_basics.a
|
||||
ifeq ($(USING_JUCE_GUI_EXTRA),true)
|
||||
CARLA_EXTRA_LIBS += $(CARLA_BUILD_DIR)/modules/$(CARLA_BUILD_TYPE)/juce_gui_extra.a
|
||||
endif
|
||||
endif
|
||||
# ifneq ($(MACOS),true)
|
||||
# CARLA_EXTRA_LIBS += -Wl,--no-whole-archive -Wl,--end-group
|
||||
# endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue