Allow Ildaeil to load arbitrary files/binaries as plugins
Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
parent
896c1ab732
commit
3a9b6623c5
2 changed files with 62 additions and 7 deletions
2
carla
2
carla
|
@ -1 +1 @@
|
||||||
Subproject commit bf501c8ce7c95b616771ef04ecf24cad6cdf81cd
|
Subproject commit bae7149b0d9145b23d98be625b9ed98342783e29
|
|
@ -705,7 +705,7 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Runner {
|
||||||
bool fPluginSearchFirstShow = false;
|
bool fPluginSearchFirstShow = false;
|
||||||
char fPluginSearchString[0xff] = {};
|
char fPluginSearchString[0xff] = {};
|
||||||
|
|
||||||
String fPopupError;
|
String fPopupError, fPluginFilename;
|
||||||
|
|
||||||
bool idleCallbackActive = false;
|
bool idleCallbackActive = false;
|
||||||
IldaeilModule* const module;
|
IldaeilModule* const module;
|
||||||
|
@ -964,6 +964,7 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Runner {
|
||||||
{
|
{
|
||||||
fPluginRunning = true;
|
fPluginRunning = true;
|
||||||
fPluginGenericUI = nullptr;
|
fPluginGenericUI = nullptr;
|
||||||
|
fPluginFilename.clear();
|
||||||
createOrUpdatePluginGenericUI(handle);
|
createOrUpdatePluginGenericUI(handle);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -976,6 +977,36 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Runner {
|
||||||
setDirty(true);
|
setDirty(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void loadFileAsPlugin(const CarlaHostHandle handle, const char* const filename)
|
||||||
|
{
|
||||||
|
if (fPluginRunning)
|
||||||
|
{
|
||||||
|
carla_show_custom_ui(handle, 0, false);
|
||||||
|
carla_replace_plugin(handle, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
carla_set_engine_option(handle, ENGINE_OPTION_PREFER_PLUGIN_BRIDGES, fPluginWillRunInBridgeMode, nullptr);
|
||||||
|
|
||||||
|
const MutexLocker cml(sPluginInfoLoadMutex);
|
||||||
|
|
||||||
|
if (carla_load_file(handle, filename))
|
||||||
|
{
|
||||||
|
fPluginRunning = true;
|
||||||
|
fPluginGenericUI = nullptr;
|
||||||
|
fPluginFilename = filename;
|
||||||
|
createOrUpdatePluginGenericUI(handle);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fPopupError = carla_get_last_error(handle);
|
||||||
|
d_stdout("got error: %s", fPopupError.buffer());
|
||||||
|
fPluginFilename.clear();
|
||||||
|
fDrawingState = kDrawingPluginError;
|
||||||
|
}
|
||||||
|
|
||||||
|
setDirty(true);
|
||||||
|
}
|
||||||
|
|
||||||
void onContextCreate(const ContextCreateEvent& e) override
|
void onContextCreate(const ContextCreateEvent& e) override
|
||||||
{
|
{
|
||||||
ImGuiWidget::onContextCreate(e);
|
ImGuiWidget::onContextCreate(e);
|
||||||
|
@ -1087,6 +1118,9 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Runner {
|
||||||
|
|
||||||
case kIdleResetPlugin:
|
case kIdleResetPlugin:
|
||||||
fIdleState = kIdleNothing;
|
fIdleState = kIdleNothing;
|
||||||
|
if (fPluginFilename.isNotEmpty())
|
||||||
|
loadFileAsPlugin(handle, fPluginFilename.buffer());
|
||||||
|
else
|
||||||
loadPlugin(handle, carla_get_plugin_info(handle, 0)->label);
|
loadPlugin(handle, carla_get_plugin_info(handle, 0)->label);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1112,10 +1146,27 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Runner {
|
||||||
|
|
||||||
case kIdleChangePluginType:
|
case kIdleChangePluginType:
|
||||||
fIdleState = kIdleNothing;
|
fIdleState = kIdleNothing;
|
||||||
|
if (fNextPluginType == PLUGIN_TYPE_COUNT)
|
||||||
|
{
|
||||||
|
if (fPluginRunning)
|
||||||
|
carla_show_custom_ui(handle, 0, false);
|
||||||
|
|
||||||
|
async_dialog_filebrowser(false, nullptr, nullptr, "Load from file", [this](char* path)
|
||||||
|
{
|
||||||
|
if (path == nullptr)
|
||||||
|
return;
|
||||||
|
|
||||||
|
loadFileAsPlugin(module->fCarlaHostHandle, path);
|
||||||
|
std::free(path);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
fPluginSelected = -1;
|
fPluginSelected = -1;
|
||||||
stopRunner();
|
stopRunner();
|
||||||
fPluginType = fNextPluginType;
|
fPluginType = fNextPluginType;
|
||||||
initAndStartRunner();
|
initAndStartRunner();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kIdleNothing:
|
case kIdleNothing:
|
||||||
|
@ -1490,6 +1541,7 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Runner {
|
||||||
getPluginTypeAsString(PLUGIN_INTERNAL),
|
getPluginTypeAsString(PLUGIN_INTERNAL),
|
||||||
getPluginTypeAsString(PLUGIN_LV2),
|
getPluginTypeAsString(PLUGIN_LV2),
|
||||||
getPluginTypeAsString(PLUGIN_JSFX),
|
getPluginTypeAsString(PLUGIN_JSFX),
|
||||||
|
"Load from file..."
|
||||||
};
|
};
|
||||||
|
|
||||||
setupMainWindowPos();
|
setupMainWindowPos();
|
||||||
|
@ -1560,6 +1612,9 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Runner {
|
||||||
case 2:
|
case 2:
|
||||||
fNextPluginType = PLUGIN_JSFX;
|
fNextPluginType = PLUGIN_JSFX;
|
||||||
break;
|
break;
|
||||||
|
case 3:
|
||||||
|
fNextPluginType = PLUGIN_TYPE_COUNT;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue