Browse Source

Better standalone and wasm behaviour, show param groups

Signed-off-by: falkTX <falktx@falktx.com>
main
falkTX 5 months ago
parent
commit
1efb1b045b
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
6 changed files with 64 additions and 12 deletions
  1. +7
    -1
      Makefile
  2. +1
    -1
      carla
  3. +1
    -1
      dpf
  4. +38
    -7
      plugins/Common/IldaeilUI.cpp
  5. +15
    -0
      plugins/Common/Makefile.mk
  6. +2
    -2
      plugins/Standalone/DistrhoPluginInfo.h

+ 7
- 1
Makefile View File

@@ -80,6 +80,12 @@ DGL_EXTRA_ARGS = \
DGL_NAMESPACE=IldaeilDGL \ DGL_NAMESPACE=IldaeilDGL \
USE_FILE_BROWSER=true USE_FILE_BROWSER=true


ifeq ($(WASM),true)
UI_TYPE = gles2
else
UI_TYPE = opengl
endif

# --------------------------------------------------------------------------------------------------------------------- # ---------------------------------------------------------------------------------------------------------------------
# DPF bundled plugins # DPF bundled plugins


@@ -141,7 +147,7 @@ extra-wine64:
$(MAKE) $(CARLA_EXTRA_ARGS) -C carla wine64 $(MAKE) $(CARLA_EXTRA_ARGS) -C carla wine64


dgl: dgl:
$(MAKE) $(DGL_EXTRA_ARGS) -C dpf/dgl opengl
$(MAKE) $(DGL_EXTRA_ARGS) -C dpf/dgl $(UI_TYPE)


plugins: carla dgl plugins: carla dgl
$(MAKE) $(CARLA_EXTRA_ARGS) $(DGL_EXTRA_ARGS) $(ILDAEIL_FX_ARGS) -C plugins/Standalone $(MAKE) $(CARLA_EXTRA_ARGS) $(DGL_EXTRA_ARGS) $(ILDAEIL_FX_ARGS) -C plugins/Standalone


+ 1
- 1
carla

@@ -1 +1 @@
Subproject commit bd96b7c403832bfc2f96e55c71711f136e1a4f88
Subproject commit 31c97d211808a20d0b5ade0612bcd09e0f31785d

+ 1
- 1
dpf

@@ -1 +1 @@
Subproject commit 81ecb86b143b83c2639407cc29cb1b91f901c3ee
Subproject commit 79e5339bef455583a4b5762addfd6578d4230f05

+ 38
- 7
plugins/Common/IldaeilUI.cpp View File

@@ -83,6 +83,7 @@ class IldaeilUI : public UI,
uint parameterCount = 0; uint parameterCount = 0;
struct Parameter { struct Parameter {
char* name = nullptr; char* name = nullptr;
char* group = nullptr;
char* printformat = nullptr; char* printformat = nullptr;
uint32_t rindex = 0; uint32_t rindex = 0;
bool boolean = false; bool boolean = false;
@@ -94,6 +95,7 @@ class IldaeilUI : public UI,
~Parameter() ~Parameter()
{ {
std::free(name); std::free(name);
std::free(group);
std::free(printformat); std::free(printformat);
} }
}* parameters = nullptr; }* parameters = nullptr;
@@ -175,6 +177,7 @@ class IldaeilUI : public UI,
String fPopupError, fPluginFilename, fDiscoveryTool; String fPopupError, fPluginFilename, fDiscoveryTool;
Size<uint> fCurrentConstraintSize, fLastSize, fNextSize; Size<uint> fCurrentConstraintSize, fLastSize, fNextSize;
bool fIgnoreNextHostWindowResize = false; bool fIgnoreNextHostWindowResize = false;
bool fInitialHostWindowShow = false;
bool fShowingHostWindow = false; bool fShowingHostWindow = false;
bool fUpdateGeometryConstraints = false; bool fUpdateGeometryConstraints = false;


@@ -347,8 +350,10 @@ public:


const uint extraHeight = kButtonHeight * getScaleFactor() + ImGui::GetStyle().WindowPadding.y * 2; const uint extraHeight = kButtonHeight * getScaleFactor() + ImGui::GetStyle().WindowPadding.y * 2;


fShowingHostWindow = true;
fNextSize = Size<uint>(width, height + extraHeight); fNextSize = Size<uint>(width, height + extraHeight);

if (fInitialHostWindowShow)
fUpdateGeometryConstraints = true;
} }


void closeUI() void closeUI()
@@ -381,6 +386,7 @@ public:
fPluginHasFileOpen = false; fPluginHasFileOpen = false;


fIgnoreNextHostWindowResize = false; fIgnoreNextHostWindowResize = false;
fInitialHostWindowShow = true;
fShowingHostWindow = true; fShowingHostWindow = true;


fPluginHostWindow.restart(); fPluginHostWindow.restart();
@@ -424,13 +430,11 @@ public:
else else
updatePluginGenericUI(handle); updatePluginGenericUI(handle);


#ifndef DISTRHO_OS_WASM
const double scaleFactor = getScaleFactor(); const double scaleFactor = getScaleFactor();
fNextSize = Size<uint>(kGenericWidth * scaleFactor, fNextSize = Size<uint>(kGenericWidth * scaleFactor,
(kGenericHeight + ImGui::GetStyle().WindowPadding.y) * scaleFactor); (kGenericHeight + ImGui::GetStyle().WindowPadding.y) * scaleFactor);
fLastSize = Size<uint>(); fLastSize = Size<uint>();
fUpdateGeometryConstraints = true; fUpdateGeometryConstraints = true;
#endif
} }


void createPluginGenericUI(const CarlaHostHandle handle, const CarlaPluginInfo* const info) void createPluginGenericUI(const CarlaHostHandle handle, const CarlaPluginInfo* const info)
@@ -486,6 +490,8 @@ public:


PluginGenericUI::Parameter& param(ui->parameters[j]); PluginGenericUI::Parameter& param(ui->parameters[j]);
param.name = strdup(pinfo->name); param.name = strdup(pinfo->name);
if (const char* const groupName = std::strchr(pinfo->groupName, ':'))
param.group = strdup(groupName + 1);
param.printformat = printformat.getAndReleaseBuffer(); param.printformat = printformat.getAndReleaseBuffer();
param.rindex = i; param.rindex = i;
param.boolean = pdata->hints & PARAMETER_IS_BOOLEAN; param.boolean = pdata->hints & PARAMETER_IS_BOOLEAN;
@@ -736,7 +742,13 @@ protected:
setGeometryConstraints(fNextSize.getWidth(), fNextSize.getHeight()); setGeometryConstraints(fNextSize.getWidth(), fNextSize.getHeight());
} }


setSize(fNextSize);
#if ILDAEIL_STANDALONE
if (fInitialHostWindowShow)
#endif
{
fInitialHostWindowShow = false;
setSize(fNextSize);
}
} }


switch (fIdleState) switch (fIdleState)
@@ -1284,8 +1296,14 @@ protected:
const double scaleFactor = getScaleFactor(); const double scaleFactor = getScaleFactor();
const float padding = ImGui::GetStyle().WindowPadding.y * 2; const float padding = ImGui::GetStyle().WindowPadding.y * 2;


#if ILDAEIL_STANDALONE
const uint width = std::min(getWidth(), d_roundToUnsignedInt(kInitialWidth * scaleFactor));
ImGui::SetNextWindowPos(ImVec2((getWidth() - width) / 2, 0));
ImGui::SetNextWindowSize(ImVec2(width, kButtonHeight * scaleFactor + padding));
#else
ImGui::SetNextWindowPos(ImVec2(0, 0)); ImGui::SetNextWindowPos(ImVec2(0, 0));
ImGui::SetNextWindowSize(ImVec2(getWidth(), kButtonHeight * scaleFactor + padding)); ImGui::SetNextWindowSize(ImVec2(getWidth(), kButtonHeight * scaleFactor + padding));
#endif


const int flags = ImGuiWindowFlags_NoSavedSettings const int flags = ImGuiWindowFlags_NoSavedSettings
| ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoTitleBar
@@ -1300,11 +1318,9 @@ protected:
{ {
fIdleState = kIdleHidePluginUI; fIdleState = kIdleHidePluginUI;
fDrawingState = kDrawingPluginList; fDrawingState = kDrawingPluginList;
#ifndef DISTRHO_OS_WASM
fNextSize = Size<uint>(kInitialWidth * scaleFactor, kInitialHeight * scaleFactor); fNextSize = Size<uint>(kInitialWidth * scaleFactor, kInitialHeight * scaleFactor);
fLastSize = Size<uint>(); fLastSize = Size<uint>();
fUpdateGeometryConstraints = true; fUpdateGeometryConstraints = true;
#endif
} }


ImGui::SameLine(); ImGui::SameLine();
@@ -1408,6 +1424,7 @@ protected:
} }


ImGui::SameLine(); ImGui::SameLine();
ImGui::SetNextItemWidth(72 * scaleFactor);
if (ImGui::Combo("##buffersize", &current, bufferSizes_s, ARRAY_SIZE(bufferSizes_s))) if (ImGui::Combo("##buffersize", &current, bufferSizes_s, ARRAY_SIZE(bufferSizes_s)))
{ {
const uint next = bufferSizes_i[current]; const uint next = bufferSizes_i[current];
@@ -1424,7 +1441,7 @@ protected:


void setupMainWindowPos() void setupMainWindowPos()
{ {
const float scaleFactor = getScaleFactor();
const double scaleFactor = getScaleFactor();


float y = 0; float y = 0;
float height = getHeight(); float height = getHeight();
@@ -1435,8 +1452,14 @@ protected:
height -= y; height -= y;
} }


#if ILDAEIL_STANDALONE
const uint width = std::min(getWidth(), d_roundToUnsignedInt(kInitialWidth * scaleFactor));
ImGui::SetNextWindowPos(ImVec2((getWidth() - width) * 0.5, y));
ImGui::SetNextWindowSize(ImVec2(width, height));
#else
ImGui::SetNextWindowPos(ImVec2(0, y)); ImGui::SetNextWindowPos(ImVec2(0, y));
ImGui::SetNextWindowSize(ImVec2(getWidth(), height)); ImGui::SetNextWindowSize(ImVec2(getWidth(), height));
#endif
} }


void drawGenericUI() void drawGenericUI()
@@ -1485,10 +1508,18 @@ protected:
} }
} }


const char* groupName = "";

for (uint32_t i=0; i < ui->parameterCount; ++i) for (uint32_t i=0; i < ui->parameterCount; ++i)
{ {
PluginGenericUI::Parameter& param(ui->parameters[i]); PluginGenericUI::Parameter& param(ui->parameters[i]);


if (param.group != nullptr && std::strcmp(param.group, groupName) != 0)
{
groupName = param.group;
ImGui::SeparatorText(groupName);
}

if (param.readonly) if (param.readonly)
{ {
ImGui::BeginDisabled(); ImGui::BeginDisabled();


+ 15
- 0
plugins/Common/Makefile.mk View File

@@ -77,6 +77,11 @@ EXTRA_LIBS = $(CARLA_EXTRA_LIBS) $(STATIC_CARLA_PLUGIN_LIBS)
# --------------------------------------------------------------------------------------------------------------------- # ---------------------------------------------------------------------------------------------------------------------
# Do some more magic # Do some more magic


ifeq ($(WASM),true)
EXTRA_DEPENDENCIES = ./jsfx
UI_TYPE = gles2
endif

USE_CLAP_BUNDLE = true USE_CLAP_BUNDLE = true
USE_VST2_BUNDLE = true USE_VST2_BUNDLE = true
include ../../dpf/Makefile.plugins.mk include ../../dpf/Makefile.plugins.mk
@@ -192,3 +197,13 @@ carlabins:
endif # USE_SYSTEM_CARLA_BINS endif # USE_SYSTEM_CARLA_BINS


# --------------------------------------------------------------------------------------------------------------------- # ---------------------------------------------------------------------------------------------------------------------
# special step for wasm resources

ifeq ($(WASM),true)

./jsfx:
wget -O - https://falktx.com/data/wasm-things-2022-08-15.tar.gz | tar xz -C $(CURDIR)

endif

# ---------------------------------------------------------------------------------------------------------------------

+ 2
- 2
plugins/Standalone/DistrhoPluginInfo.h View File

@@ -43,7 +43,7 @@


#define ILDAEIL_STANDALONE 1 #define ILDAEIL_STANDALONE 1


static constexpr const uint kInitialWidth = 640;
static constexpr const uint kInitialHeight = 480;
static constexpr const unsigned kInitialWidth = 640;
static constexpr const unsigned kInitialHeight = 480;


#endif // DISTRHO_PLUGIN_INFO_H_INCLUDED #endif // DISTRHO_PLUGIN_INFO_H_INCLUDED

Loading…
Cancel
Save