Browse Source

Better handling of file-based "UIs", showing alternative button

tags/v1.1
falkTX 2 years ago
parent
commit
e8cc68708f
3 changed files with 44 additions and 17 deletions
  1. +1
    -1
      carla
  2. +1
    -1
      dpf
  3. +42
    -15
      plugins/Common/IldaeilUI.cpp

+ 1
- 1
carla

@@ -1 +1 @@
Subproject commit 08af009062d1e542162e7f071f7f667a721235a5
Subproject commit a965cc480813a85a2bb88d932b4de797c35ff4d7

+ 1
- 1
dpf

@@ -1 +1 @@
Subproject commit 56cbf3b3ca3ab5ec7677d30978cf796a41302789
Subproject commit aaa0f5a5fe62d7e898dc69ddc36fd2800e419da4

+ 42
- 15
plugins/Common/IldaeilUI.cpp View File

@@ -136,6 +136,7 @@ class IldaeilUI : public UI,
kIdleLoadSelectedPlugin, kIdleLoadSelectedPlugin,
kIdlePluginLoadedFromDSP, kIdlePluginLoadedFromDSP,
kIdleResetPlugin, kIdleResetPlugin,
kIdleOpenFileUI,
kIdleShowCustomUI, kIdleShowCustomUI,
kIdleHideEmbedAndShowGenericUI, kIdleHideEmbedAndShowGenericUI,
kIdleHidePluginUI, kIdleHidePluginUI,
@@ -155,6 +156,7 @@ class IldaeilUI : public UI,
bool fPluginScanningFinished; bool fPluginScanningFinished;
bool fPluginHasCustomUI; bool fPluginHasCustomUI;
bool fPluginHasEmbedUI; bool fPluginHasEmbedUI;
bool fPluginHasFileOpen;
bool fPluginHasOutputParameters; bool fPluginHasOutputParameters;
bool fPluginRunning; bool fPluginRunning;
bool fPluginWillRunInBridgeMode; bool fPluginWillRunInBridgeMode;
@@ -202,6 +204,7 @@ public:
fPluginScanningFinished(false), fPluginScanningFinished(false),
fPluginHasCustomUI(false), fPluginHasCustomUI(false),
fPluginHasEmbedUI(false), fPluginHasEmbedUI(false),
fPluginHasFileOpen(false),
fPluginHasOutputParameters(false), fPluginHasOutputParameters(false),
fPluginRunning(false), fPluginRunning(false),
fPluginWillRunInBridgeMode(false), fPluginWillRunInBridgeMode(false),
@@ -296,19 +299,33 @@ public:
{ {
const CarlaHostHandle handle = fPlugin->fCarlaHostHandle; const CarlaHostHandle handle = fPlugin->fCarlaHostHandle;


if (carla_get_current_plugin_count(handle) != 0)
if (carla_get_current_plugin_count(handle) == 0)
return false;

const uint hints = carla_get_plugin_info(handle, fPluginId)->hints;
updatePluginFlags(hints);

fPluginRunning = true;
return true;
}

void updatePluginFlags(const uint hints) noexcept
{
if (hints & PLUGIN_HAS_CUSTOM_UI_USING_FILE_OPEN)
{
fPluginHasCustomUI = false;
fPluginHasEmbedUI = false;
fPluginHasFileOpen = true;
}
else
{ {
// FIXME
const uint hints = carla_get_plugin_info(handle, fPluginId)->hints;
fPluginHasCustomUI = hints & PLUGIN_HAS_CUSTOM_UI; fPluginHasCustomUI = hints & PLUGIN_HAS_CUSTOM_UI;
#ifndef DISTRHO_OS_WASM #ifndef DISTRHO_OS_WASM
fPluginHasEmbedUI = hints & PLUGIN_HAS_CUSTOM_EMBED_UI; fPluginHasEmbedUI = hints & PLUGIN_HAS_CUSTOM_EMBED_UI;
#endif #endif
fPluginRunning = true;
return true;
fPluginHasFileOpen = false;
} }


return false;
} }


void projectLoadedFromDSP() void projectLoadedFromDSP()
@@ -356,22 +373,23 @@ public:


void showPluginUI(const CarlaHostHandle handle, const bool showIfNotEmbed) void showPluginUI(const CarlaHostHandle handle, const bool showIfNotEmbed)
{ {
// FIXME
#ifndef DISTRHO_OS_WASM
const CarlaPluginInfo* const info = carla_get_plugin_info(handle, fPluginId);
const uint hints = carla_get_plugin_info(handle, fPluginId)->hints;


if (info->hints & PLUGIN_HAS_CUSTOM_EMBED_UI)
#ifndef DISTRHO_OS_WASM
if (hints & PLUGIN_HAS_CUSTOM_EMBED_UI)
{ {
fDrawingState = kDrawingPluginEmbedUI; fDrawingState = kDrawingPluginEmbedUI;
fIdleState = kIdleGiveIdleToUI; fIdleState = kIdleGiveIdleToUI;
fPluginHasCustomUI = true; fPluginHasCustomUI = true;
fPluginHasEmbedUI = true; fPluginHasEmbedUI = true;
fPluginHasFileOpen = false;


carla_embed_custom_ui(handle, fPluginId, fPluginHostWindow.attachAndGetWindowHandle()); carla_embed_custom_ui(handle, fPluginId, fPluginHostWindow.attachAndGetWindowHandle());
} }
else else
#endif #endif
{ {
// fPluginHas* flags are updated in the next function
createOrUpdatePluginGenericUI(handle); createOrUpdatePluginGenericUI(handle);


if (showIfNotEmbed && fPluginHasCustomUI) if (showIfNotEmbed && fPluginHasCustomUI)
@@ -398,11 +416,7 @@ public:
info = carla_get_plugin_info(handle, fPluginId); info = carla_get_plugin_info(handle, fPluginId);


fDrawingState = kDrawingPluginGenericUI; fDrawingState = kDrawingPluginGenericUI;
// FIXME
fPluginHasCustomUI = info->hints & PLUGIN_HAS_CUSTOM_UI;
#ifndef DISTRHO_OS_WASM
fPluginHasEmbedUI = info->hints & PLUGIN_HAS_CUSTOM_EMBED_UI;
#endif
updatePluginFlags(info->hints);


if (fPluginGenericUI == nullptr) if (fPluginGenericUI == nullptr)
createPluginGenericUI(handle, info); createPluginGenericUI(handle, info);
@@ -598,6 +612,11 @@ protected:
loadPlugin(handle, carla_get_plugin_info(handle, fPluginId)->label); loadPlugin(handle, carla_get_plugin_info(handle, fPluginId)->label);
break; break;


case kIdleOpenFileUI:
fIdleState = kIdleNothing;
carla_show_custom_ui(handle, fPluginId, true);
break;

case kIdleShowCustomUI: case kIdleShowCustomUI:
fIdleState = kIdleNothing; fIdleState = kIdleNothing;
showPluginUI(handle, true); showPluginUI(handle, true);
@@ -924,6 +943,14 @@ protected:
fIdleState = kIdleShowCustomUI; fIdleState = kIdleShowCustomUI;
} }


if (fPluginHasFileOpen)
{
ImGui::SameLine();

if (ImGui::Button("Open File..."))
fIdleState = kIdleOpenFileUI;
}

#ifdef WASM_TESTING #ifdef WASM_TESTING
ImGui::SameLine(); ImGui::SameLine();
ImGui::TextUnformatted(" Plugin to control:"); ImGui::TextUnformatted(" Plugin to control:");


Loading…
Cancel
Save