Ildaeil: Show plugin generic GUI after loading patch
Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
parent
c4426fd125
commit
6630dacd37
1 changed files with 43 additions and 10 deletions
|
@ -205,6 +205,7 @@ static void host_ui_closed(NativeHostHandle handle);
|
|||
static const char* host_ui_open_file(NativeHostHandle handle, bool isDir, const char* title, const char* filter);
|
||||
static const char* host_ui_save_file(NativeHostHandle handle, bool isDir, const char* title, const char* filter);
|
||||
static intptr_t host_dispatcher(NativeHostHandle handle, NativeHostDispatcherOpcode opcode, int32_t index, intptr_t value, void* ptr, float opt);
|
||||
static void projectLoadedFromDSP(void* ui);
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
@ -418,8 +419,13 @@ struct IldaeilModule : Module {
|
|||
CarlaEngine* const engine = carla_get_engine_from_handle(fCarlaHostHandle);
|
||||
|
||||
water::XmlDocument xml(projectState);
|
||||
const MutexLocker cml(sPluginInfoLoadMutex);
|
||||
engine->loadProjectInternal(xml, true);
|
||||
|
||||
{
|
||||
const MutexLocker cml(sPluginInfoLoadMutex);
|
||||
engine->loadProjectInternal(xml, true);
|
||||
}
|
||||
|
||||
projectLoadedFromDSP(fUI);
|
||||
}
|
||||
|
||||
void process(const ProcessArgs& args) override
|
||||
|
@ -617,6 +623,7 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Thread {
|
|||
kIdleInit,
|
||||
kIdleInitPluginAlreadyLoaded,
|
||||
kIdleLoadSelectedPlugin,
|
||||
kIdlePluginLoadedFromDSP,
|
||||
kIdleResetPlugin,
|
||||
kIdleShowCustomUI,
|
||||
kIdleHidePluginUI,
|
||||
|
@ -660,15 +667,8 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Thread {
|
|||
ImGuiStyle& style(ImGui::GetStyle());
|
||||
style.FrameRounding = 4;
|
||||
|
||||
const CarlaHostHandle handle = module->fCarlaHostHandle;
|
||||
|
||||
if (carla_get_current_plugin_count(handle) != 0)
|
||||
{
|
||||
const uint hints = carla_get_plugin_info(handle, 0)->hints;
|
||||
if (checkIfPluginIsLoaded())
|
||||
fIdleState = kIdleInitPluginAlreadyLoaded;
|
||||
fPluginRunning = true;
|
||||
fPluginHasCustomUI = hints & PLUGIN_HAS_CUSTOM_UI;
|
||||
}
|
||||
|
||||
module->fUI = this;
|
||||
}
|
||||
|
@ -696,6 +696,28 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Thread {
|
|||
delete[] fPlugins;
|
||||
}
|
||||
|
||||
bool checkIfPluginIsLoaded()
|
||||
{
|
||||
const CarlaHostHandle handle = module->fCarlaHostHandle;
|
||||
|
||||
if (carla_get_current_plugin_count(handle) != 0)
|
||||
{
|
||||
const uint hints = carla_get_plugin_info(handle, 0)->hints;
|
||||
|
||||
fPluginRunning = true;
|
||||
fPluginHasCustomUI = hints & PLUGIN_HAS_CUSTOM_UI;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void projectLoadedFromDSP()
|
||||
{
|
||||
if (checkIfPluginIsLoaded())
|
||||
fIdleState = kIdlePluginLoadedFromDSP;
|
||||
}
|
||||
|
||||
void changeParameterFromDSP(const uint32_t index, const float value)
|
||||
{
|
||||
if (PluginGenericUI* const ui = fPluginGenericUI)
|
||||
|
@ -933,6 +955,11 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Thread {
|
|||
startThread();
|
||||
break;
|
||||
|
||||
case kIdlePluginLoadedFromDSP:
|
||||
fIdleState = kIdleNothing;
|
||||
createOrUpdatePluginGenericUI(handle);
|
||||
break;
|
||||
|
||||
case kIdleLoadSelectedPlugin:
|
||||
fIdleState = kIdleNothing;
|
||||
loadSelectedPlugin(handle);
|
||||
|
@ -1403,6 +1430,12 @@ static const char* host_ui_open_file(const NativeHostHandle handle,
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
static void projectLoadedFromDSP(void* const ui)
|
||||
{
|
||||
if (IldaeilWidget* const uiw = static_cast<IldaeilWidget*>(ui))
|
||||
uiw->projectLoadedFromDSP();
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
struct IldaeilModuleWidget : ModuleWidget {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue