diff --git a/Makefile b/Makefile index 18f9c8a..fc69802 100644 --- a/Makefile +++ b/Makefile @@ -80,6 +80,12 @@ DGL_EXTRA_ARGS = \ DGL_NAMESPACE=IldaeilDGL \ USE_FILE_BROWSER=true +ifeq ($(WASM),true) +UI_TYPE = gles2 +else +UI_TYPE = opengl +endif + # --------------------------------------------------------------------------------------------------------------------- # DPF bundled plugins @@ -141,7 +147,7 @@ extra-wine64: $(MAKE) $(CARLA_EXTRA_ARGS) -C carla wine64 dgl: - $(MAKE) $(DGL_EXTRA_ARGS) -C dpf/dgl opengl + $(MAKE) $(DGL_EXTRA_ARGS) -C dpf/dgl $(UI_TYPE) plugins: carla dgl $(MAKE) $(CARLA_EXTRA_ARGS) $(DGL_EXTRA_ARGS) $(ILDAEIL_FX_ARGS) -C plugins/Standalone diff --git a/carla b/carla index bd96b7c..31c97d2 160000 --- a/carla +++ b/carla @@ -1 +1 @@ -Subproject commit bd96b7c403832bfc2f96e55c71711f136e1a4f88 +Subproject commit 31c97d211808a20d0b5ade0612bcd09e0f31785d diff --git a/dpf b/dpf index 81ecb86..79e5339 160000 --- a/dpf +++ b/dpf @@ -1 +1 @@ -Subproject commit 81ecb86b143b83c2639407cc29cb1b91f901c3ee +Subproject commit 79e5339bef455583a4b5762addfd6578d4230f05 diff --git a/plugins/Common/IldaeilUI.cpp b/plugins/Common/IldaeilUI.cpp index 481a7d7..029025b 100644 --- a/plugins/Common/IldaeilUI.cpp +++ b/plugins/Common/IldaeilUI.cpp @@ -83,6 +83,7 @@ class IldaeilUI : public UI, uint parameterCount = 0; struct Parameter { char* name = nullptr; + char* group = nullptr; char* printformat = nullptr; uint32_t rindex = 0; bool boolean = false; @@ -94,6 +95,7 @@ class IldaeilUI : public UI, ~Parameter() { std::free(name); + std::free(group); std::free(printformat); } }* parameters = nullptr; @@ -175,6 +177,7 @@ class IldaeilUI : public UI, String fPopupError, fPluginFilename, fDiscoveryTool; Size fCurrentConstraintSize, fLastSize, fNextSize; bool fIgnoreNextHostWindowResize = false; + bool fInitialHostWindowShow = false; bool fShowingHostWindow = false; bool fUpdateGeometryConstraints = false; @@ -347,8 +350,10 @@ public: const uint extraHeight = kButtonHeight * getScaleFactor() + ImGui::GetStyle().WindowPadding.y * 2; - fShowingHostWindow = true; fNextSize = Size(width, height + extraHeight); + + if (fInitialHostWindowShow) + fUpdateGeometryConstraints = true; } void closeUI() @@ -381,6 +386,7 @@ public: fPluginHasFileOpen = false; fIgnoreNextHostWindowResize = false; + fInitialHostWindowShow = true; fShowingHostWindow = true; fPluginHostWindow.restart(); @@ -424,13 +430,11 @@ public: else updatePluginGenericUI(handle); - #ifndef DISTRHO_OS_WASM const double scaleFactor = getScaleFactor(); fNextSize = Size(kGenericWidth * scaleFactor, (kGenericHeight + ImGui::GetStyle().WindowPadding.y) * scaleFactor); fLastSize = Size(); fUpdateGeometryConstraints = true; - #endif } void createPluginGenericUI(const CarlaHostHandle handle, const CarlaPluginInfo* const info) @@ -486,6 +490,8 @@ public: PluginGenericUI::Parameter& param(ui->parameters[j]); param.name = strdup(pinfo->name); + if (const char* const groupName = std::strchr(pinfo->groupName, ':')) + param.group = strdup(groupName + 1); param.printformat = printformat.getAndReleaseBuffer(); param.rindex = i; param.boolean = pdata->hints & PARAMETER_IS_BOOLEAN; @@ -736,7 +742,13 @@ protected: setGeometryConstraints(fNextSize.getWidth(), fNextSize.getHeight()); } - setSize(fNextSize); + #if ILDAEIL_STANDALONE + if (fInitialHostWindowShow) + #endif + { + fInitialHostWindowShow = false; + setSize(fNextSize); + } } switch (fIdleState) @@ -1284,8 +1296,14 @@ protected: const double scaleFactor = getScaleFactor(); 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::SetNextWindowSize(ImVec2(getWidth(), kButtonHeight * scaleFactor + padding)); + #endif const int flags = ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoTitleBar @@ -1300,11 +1318,9 @@ protected: { fIdleState = kIdleHidePluginUI; fDrawingState = kDrawingPluginList; - #ifndef DISTRHO_OS_WASM fNextSize = Size(kInitialWidth * scaleFactor, kInitialHeight * scaleFactor); fLastSize = Size(); fUpdateGeometryConstraints = true; - #endif } ImGui::SameLine(); @@ -1408,6 +1424,7 @@ protected: } ImGui::SameLine(); + ImGui::SetNextItemWidth(72 * scaleFactor); if (ImGui::Combo("##buffersize", ¤t, bufferSizes_s, ARRAY_SIZE(bufferSizes_s))) { const uint next = bufferSizes_i[current]; @@ -1424,7 +1441,7 @@ protected: void setupMainWindowPos() { - const float scaleFactor = getScaleFactor(); + const double scaleFactor = getScaleFactor(); float y = 0; float height = getHeight(); @@ -1435,8 +1452,14 @@ protected: 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::SetNextWindowSize(ImVec2(getWidth(), height)); + #endif } void drawGenericUI() @@ -1485,10 +1508,18 @@ protected: } } + const char* groupName = ""; + for (uint32_t i=0; i < ui->parameterCount; ++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) { ImGui::BeginDisabled(); diff --git a/plugins/Common/Makefile.mk b/plugins/Common/Makefile.mk index 9999969..9a1b456 100644 --- a/plugins/Common/Makefile.mk +++ b/plugins/Common/Makefile.mk @@ -77,6 +77,11 @@ EXTRA_LIBS = $(CARLA_EXTRA_LIBS) $(STATIC_CARLA_PLUGIN_LIBS) # --------------------------------------------------------------------------------------------------------------------- # Do some more magic +ifeq ($(WASM),true) +EXTRA_DEPENDENCIES = ./jsfx +UI_TYPE = gles2 +endif + USE_CLAP_BUNDLE = true USE_VST2_BUNDLE = true include ../../dpf/Makefile.plugins.mk @@ -192,3 +197,13 @@ carlabins: 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 + +# --------------------------------------------------------------------------------------------------------------------- diff --git a/plugins/Standalone/DistrhoPluginInfo.h b/plugins/Standalone/DistrhoPluginInfo.h index faac5bf..d2707b9 100644 --- a/plugins/Standalone/DistrhoPluginInfo.h +++ b/plugins/Standalone/DistrhoPluginInfo.h @@ -43,7 +43,7 @@ #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