diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6313d87..01f1d8c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,7 +15,7 @@ jobs: target: [linux-arm64, linux-armhf, linux-i686, linux-riscv64, linux-x86_64] runs-on: ubuntu-latest container: - image: ubuntu:20.04 + image: ubuntu:22.04 steps: - uses: actions/checkout@v4 - uses: distrho/dpf-makefile-action@v1 @@ -26,7 +26,7 @@ jobs: strategy: matrix: target: [macos-intel, macos-universal] - runs-on: macos-13 + runs-on: macos-14 steps: - uses: actions/checkout@v4 - uses: distrho/dpf-makefile-action@v1 diff --git a/dpf/CMakeLists.txt b/dpf/CMakeLists.txt deleted file mode 100644 index 5f0d7b9..0000000 --- a/dpf/CMakeLists.txt +++ /dev/null @@ -1,61 +0,0 @@ -# DISTRHO Plugin Framework (DPF) -# Copyright (C) 2021 Jean Pierre Cimalando -# Copyright (C) 2022-2025 Filipe Coelho -# -# SPDX-License-Identifier: ISC - -cmake_minimum_required(VERSION 3.8...3.31) - -project(DPF) - -# ensure c++11 at minimum, the parent project can override -if(NOT CMAKE_CXX_STANDARD) - set(CMAKE_CXX_STANDARD 11) -endif() - -# check if we are building from this project, or are imported by another -if(PROJECT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) - set(DPF_BUILD_FROM_HERE TRUE) -else() - set(DPF_BUILD_FROM_HERE FALSE) -endif() - -option(DPF_LIBRARIES "Build the libraries" "${DPF_BUILD_FROM_HERE}") -option(DPF_EXAMPLES "Build the examples" "${DPF_BUILD_FROM_HERE}") - -set(DPF_ROOT_DIR "${PROJECT_SOURCE_DIR}" CACHE INTERNAL - "Root directory of the DISTRHO Plugin Framework.") - -list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") -include(DPF-plugin) - -if(DPF_LIBRARIES) - find_package(PkgConfig QUIET) - if(PKG_CONFIG_FOUND) - pkg_check_modules(CAIRO "cairo") - if(CAIRO_FOUND AND (NOT HAIKU)) - dpf__add_dgl_cairo(TRUE, TRUE, TRUE) - endif() - endif() - dpf__add_dgl_external(TRUE, TRUE) - dpf__add_dgl_opengl(TRUE, TRUE, TRUE) -endif() - -if(DPF_EXAMPLES) - find_package(PkgConfig QUIET) - if(PKG_CONFIG_FOUND) - pkg_check_modules(CAIRO "cairo") - if(CAIRO_FOUND AND (NOT HAIKU)) - add_subdirectory("examples/CairoUI") - endif() - endif() - add_subdirectory("examples/EmbedExternalUI") - add_subdirectory("examples/FileHandling") - add_subdirectory("examples/Info") - add_subdirectory("examples/Latency") - add_subdirectory("examples/Meters") - add_subdirectory("examples/MidiThrough") - add_subdirectory("examples/Parameters") - add_subdirectory("examples/States") - add_subdirectory("examples/WebMeters") -endif() diff --git a/dpf/Makefile.plugins.mk b/dpf/Makefile.plugins.mk index f539580..0476199 100644 --- a/dpf/Makefile.plugins.mk +++ b/dpf/Makefile.plugins.mk @@ -375,9 +375,10 @@ endif ifeq ($(WASM),true) MAPI_EXT = -mapi.js MAPI_SHARED = \ + -sALLOW_MEMORY_GROWTH \ + -sALLOW_TABLE_GROWTH \ -sEXPORT_NAME="$(MAPI_MODULE_NAME)" \ -sEXPORTED_RUNTIME_METHODS=['addFunction','lengthBytesUTF8','stringToUTF8','UTF8ToString'] \ - -sMAIN_MODULE=2 \ -sMODULARIZE=1 else MAPI_EXT = $(LIB_EXT) @@ -450,7 +451,7 @@ SYMBOLS_LADSPA = -sEXPORTED_FUNCTIONS="['ladspa_descriptor']" SYMBOLS_LV2 = -sEXPORTED_FUNCTIONS="['lv2_descriptor','lv2_generate_ttl','lv2ui_descriptor']" SYMBOLS_LV2DSP = -sEXPORTED_FUNCTIONS="['lv2_descriptor','lv2_generate_ttl']" SYMBOLS_LV2UI = -sEXPORTED_FUNCTIONS="['lv2ui_descriptor']" -SYMBOLS_MAPI = -sEXPORTED_FUNCTIONS="['_mapi_create','_mapi_process','_mapi_set_parameter','_mapi_set_state','_mapi_destroy']" +SYMBOLS_MAPI = -sEXPORTED_FUNCTIONS="['_malloc','_free','_mapi_create','_mapi_process','_mapi_get_parameter','_mapi_set_parameter','_mapi_set_state','_mapi_destroy']" SYMBOLS_VST2 = -sEXPORTED_FUNCTIONS="['VSTPluginMain']" SYMBOLS_VST3 = -sEXPORTED_FUNCTIONS="['GetPluginFactory','ModuleEntry','ModuleExit']" else ifeq ($(WINDOWS),true) @@ -650,9 +651,9 @@ $(dssi_ui): $(OBJS_UI) $(BUILD_DIR)/DistrhoUIMain_DSSI.cpp.o $(DGL_LIB) # --------------------------------------------------------------------------------------------------------------------- # LV2 -lv2: $(lv2) -lv2_dsp: $(lv2_dsp) -lv2_sep: $(lv2_dsp) $(lv2_ui) +lv2: $(lv2) $(lv2files) +lv2_dsp: $(lv2_dsp) $(lv2files) +lv2_sep: $(lv2_dsp) $(lv2_ui) $(lv2files) ifeq ($(HAVE_DGL),true) $(lv2): $(OBJS_DSP) $(OBJS_UI) $(BUILD_DIR)/DistrhoPluginMain_LV2_single_obj.cpp.o $(BUILD_DIR)/DistrhoUIMain_LV2_single_obj.cpp.o $(DGL_LIB) $(DGL_LIB_SHARED) diff --git a/dpf/dgl/StandaloneWindow.hpp b/dpf/dgl/StandaloneWindow.hpp index 5b77e58..cf8604b 100644 --- a/dpf/dgl/StandaloneWindow.hpp +++ b/dpf/dgl/StandaloneWindow.hpp @@ -1,6 +1,6 @@ /* * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2022 Filipe Coelho + * Copyright (C) 2012-2026 Filipe Coelho * * Permission to use, copy, modify, and/or distribute this software for any purpose with * or without fee is hereby granted, provided that the above copyright notice and this @@ -84,9 +84,34 @@ public: Application& getApp() const noexcept { return Window::getApp(); } const GraphicsContext& getGraphicsContext() const noexcept { return Window::getGraphicsContext(); } double getScaleFactor() const noexcept { return Window::getScaleFactor(); } - void setGeometryConstraints(uint minimumWidth, uint minimumHeight, - bool keepAspectRatio = false, bool automaticallyScale = false) - { Window::setGeometryConstraints(minimumWidth, minimumHeight, keepAspectRatio, automaticallyScale); } + + void setGeometryConstraints(uint minimumWidth, uint minimumHeight, bool keepAspectRatio = false) + { Window::setGeometryConstraints(minimumWidth, minimumHeight, keepAspectRatio); } + + #if DGL_ALLOW_DEPRECATED_METHODS + DISTRHO_DEPRECATED_BY("setGeometryConstraints(uint, uint, bool)") + void setGeometryConstraints(uint minimumWidth, uint minimumHeight, bool keepAspectRatio, bool automaticallyScale) + { + #if defined(_MSC_VER) + #pragma warning(push) + #pragma warning(disable:4996) + #elif defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wdeprecated-declarations" + #elif defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 460 + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wdeprecated-declarations" + #endif + Window::setGeometryConstraints(minimumWidth, minimumHeight, keepAspectRatio, automaticallyScale, false); + #if defined(_MSC_VER) + #pragma warning(pop) + #elif defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 460 + #pragma GCC diagnostic pop + #endif + } + #endif private: ScopedGraphicsContext sgc; diff --git a/dpf/dgl/TopLevelWidget.hpp b/dpf/dgl/TopLevelWidget.hpp index 47015a6..2143156 100644 --- a/dpf/dgl/TopLevelWidget.hpp +++ b/dpf/dgl/TopLevelWidget.hpp @@ -1,6 +1,6 @@ /* * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2021 Filipe Coelho + * Copyright (C) 2012-2026 Filipe Coelho * * Permission to use, copy, modify, and/or distribute this software for any purpose with * or without fee is hereby granted, provided that the above copyright notice and this @@ -107,17 +107,27 @@ public: bool addIdleCallback(IdleCallback* callback, uint timerFrequencyInMs = 0); bool removeIdleCallback(IdleCallback* callback); double getScaleFactor() const noexcept; + + void setGeometryConstraints(uint minimumWidth, uint minimumHeight, bool keepAspectRatio = false); + + #if DGL_ALLOW_DEPRECATED_METHODS + /** DEPRECATED DO NOT USE. + * The old deprecated function allowed for optional `bool automaticallyScale` and `bool resizeNowIfAutoScaling`. + * This turned out to be not be a good idea; now the scaling on constraints is never done automatically. + */ + DISTRHO_DEPRECATED_BY("setGeometryConstraints(uint, uint, bool)") void setGeometryConstraints(uint minimumWidth, uint minimumHeight, - bool keepAspectRatio = false, - bool automaticallyScale = false, - bool resizeNowIfAutoScaling = true); + bool keepAspectRatio, + bool automaticallyScale, + bool resizeNowIfAutoScaling); DISTRHO_DEPRECATED_BY("getApp()") Application& getParentApp() const noexcept { return getApp(); } DISTRHO_DEPRECATED_BY("getWindow()") Window& getParentWindow() const noexcept { return getWindow(); } + #endif protected: bool onKeyboard(const KeyboardEvent&) override; diff --git a/dpf/dgl/Widget.hpp b/dpf/dgl/Widget.hpp index 7766f48..f70257b 100644 --- a/dpf/dgl/Widget.hpp +++ b/dpf/dgl/Widget.hpp @@ -1,6 +1,6 @@ /* * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2024 Filipe Coelho + * Copyright (C) 2012-2026 Filipe Coelho * * Permission to use, copy, modify, and/or distribute this software for any purpose with * or without fee is hereby granted, provided that the above copyright notice and this diff --git a/dpf/dgl/Window.hpp b/dpf/dgl/Window.hpp index 2a811b0..6898f6a 100644 --- a/dpf/dgl/Window.hpp +++ b/dpf/dgl/Window.hpp @@ -1,6 +1,6 @@ /* * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2025 Filipe Coelho + * Copyright (C) 2012-2026 Filipe Coelho * * Permission to use, copy, modify, and/or distribute this software for any purpose with * or without fee is hereby granted, provided that the above copyright notice and this @@ -393,6 +393,16 @@ public: */ double getScaleFactor() const noexcept; + /** + Enable automatic internal scaling based on a custom width and height. + This will internally scale up drawing and scale down user events coordinates and sizes, + but the result is likely blurry. + + This can be used as an early step for high-dpi support, + that scales up the window contents in a blurry but usable way. + */ + void enableInternalScalingWithSize(uint baseWidth, uint baseHeight, bool keepAspectRatio = false); + /** Grab the keyboard input focus. */ @@ -463,13 +473,23 @@ public: Size getGeometryConstraints(bool& keepAspectRatio); /** - Set geometry constraints for the Window when resized by the user, and optionally scale contents automatically. + Set geometry constraints for the Window when resized by the user. + Also whether to keep aspect ratio based on this size. */ + void setGeometryConstraints(uint minimumWidth, uint minimumHeight, bool keepAspectRatio = false); + + #if DGL_ALLOW_DEPRECATED_METHODS + /** DEPRECATED DO NOT USE. + * The old deprecated function allowed for optional `bool automaticallyScale` and `bool resizeNowIfAutoScaling`. + * This turned out to be not be a good idea; now the scaling on constraints is never done automatically. + */ + DISTRHO_DEPRECATED_BY("setGeometryConstraints(uint, uint, bool)") void setGeometryConstraints(uint minimumWidth, uint minimumHeight, - bool keepAspectRatio = false, - bool automaticallyScale = false, - bool resizeNowIfAutoScaling = true); + bool keepAspectRatio, + bool automaticallyScale, + bool resizeNowIfAutoScaling); + #endif /** Set the transient parent of the window. diff --git a/dpf/dgl/src/Cairo.cpp b/dpf/dgl/src/Cairo.cpp index f0a5b30..ab2296d 100644 --- a/dpf/dgl/src/Cairo.cpp +++ b/dpf/dgl/src/Cairo.cpp @@ -1,7 +1,7 @@ /* * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2025 Filipe Coelho * Copyright (C) 2019-2021 Jean Pierre Cimalando + * Copyright (C) 2012-2026 Filipe Coelho * * Permission to use, copy, modify, and/or distribute this software for any purpose with * or without fee is hereby granted, provided that the above copyright notice and this diff --git a/dpf/dgl/src/ImageBaseWidgets.cpp b/dpf/dgl/src/ImageBaseWidgets.cpp index 24cc0e6..0d7d0f4 100644 --- a/dpf/dgl/src/ImageBaseWidgets.cpp +++ b/dpf/dgl/src/ImageBaseWidgets.cpp @@ -1,6 +1,6 @@ /* * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2022 Filipe Coelho + * Copyright (C) 2012-2026 Filipe Coelho * * Permission to use, copy, modify, and/or distribute this software for any purpose with * or without fee is hereby granted, provided that the above copyright notice and this @@ -31,8 +31,8 @@ ImageBaseAboutWindow::ImageBaseAboutWindow(Window& transientParentWin if (image.isValid()) { + enableInternalScalingWithSize(image.getWidth(), image.getHeight(), true); setSize(image.getSize()); - setGeometryConstraints(image.getWidth(), image.getHeight(), true, true); } done(); @@ -48,8 +48,8 @@ ImageBaseAboutWindow::ImageBaseAboutWindow(TopLevelWidget* const topL if (image.isValid()) { + enableInternalScalingWithSize(image.getWidth(), image.getHeight(), true); setSize(image.getSize()); - setGeometryConstraints(image.getWidth(), image.getHeight(), true, true); } done(); @@ -71,8 +71,8 @@ void ImageBaseAboutWindow::setImage(const ImageType& image) img = image; + enableInternalScalingWithSize(image.getWidth(), image.getHeight(), true); setSize(image.getSize()); - setGeometryConstraints(image.getWidth(), image.getHeight(), true, true); done(); } diff --git a/dpf/dgl/src/OpenGL.cpp b/dpf/dgl/src/OpenGL.cpp index 5eac3eb..da15805 100644 --- a/dpf/dgl/src/OpenGL.cpp +++ b/dpf/dgl/src/OpenGL.cpp @@ -1,6 +1,6 @@ /* * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2025 Filipe Coelho + * Copyright (C) 2012-2026 Filipe Coelho * * Permission to use, copy, modify, and/or distribute this software for any purpose with * or without fee is hereby granted, provided that the above copyright notice and this diff --git a/dpf/dgl/src/OpenGL2.cpp b/dpf/dgl/src/OpenGL2.cpp index bdfd900..dda6935 100644 --- a/dpf/dgl/src/OpenGL2.cpp +++ b/dpf/dgl/src/OpenGL2.cpp @@ -1,6 +1,6 @@ /* * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2025 Filipe Coelho + * Copyright (C) 2012-2026 Filipe Coelho * * Permission to use, copy, modify, and/or distribute this software for any purpose with * or without fee is hereby granted, provided that the above copyright notice and this @@ -538,7 +538,12 @@ void Window::PrivateData::startContext() glViewport(0, 0, static_cast(size.width), static_cast(size.height)); glMatrixMode(GL_PROJECTION); glLoadIdentity(); - glOrtho(0.0, static_cast(size.width), static_cast(size.height), 0.0, 0.0, 1.0); + glOrtho(0.0, + static_cast(size.width) / autoScaleFactor, + static_cast(size.height) / autoScaleFactor, + 0.0, + 0.0, + 1.0); glViewport(0, 0, static_cast(size.width), static_cast(size.height)); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); diff --git a/dpf/dgl/src/SubWidgetPrivateData.hpp b/dpf/dgl/src/SubWidgetPrivateData.hpp index a06f59d..beea81c 100644 --- a/dpf/dgl/src/SubWidgetPrivateData.hpp +++ b/dpf/dgl/src/SubWidgetPrivateData.hpp @@ -1,6 +1,6 @@ /* * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2021 Filipe Coelho + * Copyright (C) 2012-2026 Filipe Coelho * * Permission to use, copy, modify, and/or distribute this software for any purpose with * or without fee is hereby granted, provided that the above copyright notice and this diff --git a/dpf/dgl/src/TopLevelWidget.cpp b/dpf/dgl/src/TopLevelWidget.cpp index ab1fa4b..61dd5e3 100644 --- a/dpf/dgl/src/TopLevelWidget.cpp +++ b/dpf/dgl/src/TopLevelWidget.cpp @@ -1,6 +1,6 @@ /* * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2021 Filipe Coelho + * Copyright (C) 2012-2026 Filipe Coelho * * Permission to use, copy, modify, and/or distribute this software for any purpose with * or without fee is hereby granted, provided that the above copyright notice and this @@ -100,18 +100,42 @@ void TopLevelWidget::repaint(const Rectangle& rect) noexcept pData->window.repaint(rect); } +void TopLevelWidget::setGeometryConstraints(const uint minimumWidth, const uint minimumHeight, const bool keepAspectRatio) +{ + pData->window.setGeometryConstraints(minimumWidth, minimumHeight, keepAspectRatio); +} + +#if DGL_ALLOW_DEPRECATED_METHODS void TopLevelWidget::setGeometryConstraints(const uint minimumWidth, const uint minimumHeight, const bool keepAspectRatio, const bool automaticallyScale, const bool resizeNowIfAutoScaling) { + #if defined(_MSC_VER) + #pragma warning(push) + #pragma warning(disable:4996) + #elif defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wdeprecated-declarations" + #elif defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 460 + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wdeprecated-declarations" + #endif pData->window.setGeometryConstraints(minimumWidth, minimumHeight, keepAspectRatio, automaticallyScale, resizeNowIfAutoScaling); -} + #if defined(_MSC_VER) + #pragma warning(pop) + #elif defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 460 + #pragma GCC diagnostic pop + #endif +} +#endif // -------------------------------------------------------------------------------------------------------------------- diff --git a/dpf/dgl/src/TopLevelWidgetPrivateData.cpp b/dpf/dgl/src/TopLevelWidgetPrivateData.cpp index adcd71b..90efddd 100644 --- a/dpf/dgl/src/TopLevelWidgetPrivateData.cpp +++ b/dpf/dgl/src/TopLevelWidgetPrivateData.cpp @@ -1,6 +1,6 @@ /* * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2021 Filipe Coelho + * Copyright (C) 2012-2026 Filipe Coelho * * Permission to use, copy, modify, and/or distribute this software for any purpose with * or without fee is hereby granted, provided that the above copyright notice and this @@ -17,7 +17,6 @@ #include "TopLevelWidgetPrivateData.hpp" #include "WidgetPrivateData.hpp" #include "WindowPrivateData.hpp" -#include "pugl.hpp" START_NAMESPACE_DGL diff --git a/dpf/dgl/src/WidgetPrivateData.cpp b/dpf/dgl/src/WidgetPrivateData.cpp index e05073c..52990ee 100644 --- a/dpf/dgl/src/WidgetPrivateData.cpp +++ b/dpf/dgl/src/WidgetPrivateData.cpp @@ -1,6 +1,6 @@ /* * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2022 Filipe Coelho + * Copyright (C) 2012-2026 Filipe Coelho * * Permission to use, copy, modify, and/or distribute this software for any purpose with * or without fee is hereby granted, provided that the above copyright notice and this diff --git a/dpf/dgl/src/WidgetPrivateData.hpp b/dpf/dgl/src/WidgetPrivateData.hpp index 9cc157f..19ecc94 100644 --- a/dpf/dgl/src/WidgetPrivateData.hpp +++ b/dpf/dgl/src/WidgetPrivateData.hpp @@ -1,6 +1,6 @@ /* * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2022 Filipe Coelho + * Copyright (C) 2012-2026 Filipe Coelho * * Permission to use, copy, modify, and/or distribute this software for any purpose with * or without fee is hereby granted, provided that the above copyright notice and this diff --git a/dpf/dgl/src/Window.cpp b/dpf/dgl/src/Window.cpp index 01c285e..724d865 100644 --- a/dpf/dgl/src/Window.cpp +++ b/dpf/dgl/src/Window.cpp @@ -1,6 +1,6 @@ /* * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2025 Filipe Coelho + * Copyright (C) 2012-2026 Filipe Coelho * * Permission to use, copy, modify, and/or distribute this software for any purpose with * or without fee is hereby granted, provided that the above copyright notice and this @@ -270,29 +270,31 @@ void Window::setSize(uint width, uint height) { DISTRHO_SAFE_ASSERT_UINT2_RETURN(width > 1 && height > 1, width, height,); + const double scaleFactor = pData->scaleFactor; + if (pData->isEmbed) { - const double scaleFactor = pData->scaleFactor; - uint minWidth = pData->minWidth; - uint minHeight = pData->minHeight; + PuglArea area = puglGetSizeHint(pData->view, PUGL_FIXED_ASPECT); if (pData->autoScaling && d_isNotEqual(scaleFactor, 1.0)) { - minWidth = d_roundToUnsignedInt(minWidth * scaleFactor); - minHeight = d_roundToUnsignedInt(minHeight * scaleFactor); + area.width = d_roundToUnsignedInt(area.width * scaleFactor); + area.height = d_roundToUnsignedInt(area.height * scaleFactor); + width = d_roundToUnsignedInt(width * scaleFactor); + height = d_roundToUnsignedInt(height * scaleFactor); } // handle geometry constraints here - if (width < minWidth) - width = minWidth; + if (width < area.width) + width = area.width; - if (height < minHeight) - height = minHeight; + if (height < area.height) + height = area.height; - if (pData->keepAspectRatio) + if (area.width != 0 && area.height != 0) { - const double ratio = static_cast(pData->minWidth) - / static_cast(pData->minHeight); + const double ratio = static_cast(area.width) + / static_cast(area.height); const double reqRatio = static_cast(width) / static_cast(height); @@ -307,6 +309,14 @@ void Window::setSize(uint width, uint height) } } } + else + { + if (pData->autoScaling && d_isNotEqual(scaleFactor, 1.0)) + { + width = d_roundToUnsignedInt(width * scaleFactor); + height = d_roundToUnsignedInt(height * scaleFactor); + } + } if (pData->usesSizeRequest) { @@ -412,6 +422,34 @@ double Window::getScaleFactor() const noexcept return pData->scaleFactor; } +void Window::enableInternalScalingWithSize(uint baseWidth, uint baseHeight, const bool keepAspectRatio) +{ + DISTRHO_SAFE_ASSERT_RETURN(baseWidth > 0,); + DISTRHO_SAFE_ASSERT_RETURN(baseHeight > 0,); + + const Size size(getSize()); + const double scaleHorizontal = size.getWidth() / static_cast(baseWidth); + const double scaleVertical = size.getHeight() / static_cast(baseHeight); + + pData->baseWidth = baseWidth; + pData->baseHeight = baseHeight; + pData->autoScaling = true; + pData->autoScaleFactor = scaleHorizontal < scaleVertical ? scaleHorizontal : scaleVertical; + + if (pData->view == nullptr) + return; + + const double scaleFactor = pData->scaleFactor; + + if (d_isNotEqual(scaleFactor, 1.0)) + { + baseWidth = d_roundToUnsignedInt(baseWidth * scaleFactor); + baseHeight = d_roundToUnsignedInt(baseHeight * scaleFactor); + } + + puglSetGeometryConstraints(pData->view, baseWidth, baseHeight, keepAspectRatio); +} + void Window::focus() { pData->focus(); @@ -487,10 +525,21 @@ void Window::runAsModal(bool blockWait) Size Window::getGeometryConstraints(bool& keepAspectRatio) { - keepAspectRatio = pData->keepAspectRatio; - return Size(pData->minWidth, pData->minHeight); + const PuglArea area = puglGetSizeHint(pData->view, PUGL_FIXED_ASPECT); + keepAspectRatio = area.width != 0 && area.height != 0; + return Size(area.width, area.height); +} + +void Window::setGeometryConstraints(const uint minimumWidth, const uint minimumHeight, const bool keepAspectRatio) +{ + DISTRHO_SAFE_ASSERT_RETURN(minimumWidth > 0,); + DISTRHO_SAFE_ASSERT_RETURN(minimumHeight > 0,); + + if (pData->view != nullptr) + puglSetGeometryConstraints(pData->view, minimumWidth, minimumHeight, keepAspectRatio); } +#if DGL_ALLOW_DEPRECATED_METHODS void Window::setGeometryConstraints(uint minimumWidth, uint minimumHeight, const bool keepAspectRatio, @@ -504,10 +553,18 @@ void Window::setGeometryConstraints(uint minimumWidth, if (resizeNowIfAutoScaling && automaticallyScale && pData->autoScaling == automaticallyScale) resizeNowIfAutoScaling = false; - pData->minWidth = minimumWidth; - pData->minHeight = minimumHeight; - pData->autoScaling = automaticallyScale; - pData->keepAspectRatio = keepAspectRatio; + if (automaticallyScale) + { + pData->autoScaling = true; + pData->baseWidth = minimumWidth; + pData->baseHeight = minimumHeight; + } + else + { + pData->autoScaling = false; + pData->baseWidth = 0; + pData->baseHeight = 0; + } if (pData->view == nullptr) return; @@ -530,6 +587,7 @@ void Window::setGeometryConstraints(uint minimumWidth, d_roundToUnsignedInt(size.getHeight() * scaleFactor)); } } +#endif void Window::setTransientParent(const uintptr_t transientParentWindowHandle) { diff --git a/dpf/dgl/src/WindowPrivateData.cpp b/dpf/dgl/src/WindowPrivateData.cpp index 563d2b4..f06a884 100644 --- a/dpf/dgl/src/WindowPrivateData.cpp +++ b/dpf/dgl/src/WindowPrivateData.cpp @@ -1,6 +1,6 @@ /* * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2025 Filipe Coelho + * Copyright (C) 2012-2026 Filipe Coelho * * Permission to use, copy, modify, and/or distribute this software for any purpose with * or without fee is hereby granted, provided that the above copyright notice and this @@ -118,9 +118,8 @@ Window::PrivateData::PrivateData(Application& a, Window* const s) scaleFactor(DGL_NAMESPACE::getScaleFactor(view)), autoScaling(false), autoScaleFactor(1.0), - minWidth(0), - minHeight(0), - keepAspectRatio(false), + baseWidth(0), + baseHeight(0), ignoreIdleCallbacks(false), waitingForClipboardData(false), waitingForClipboardEvents(false), @@ -151,9 +150,8 @@ Window::PrivateData::PrivateData(Application& a, Window* const s, PrivateData* c scaleFactor(ppData->scaleFactor), autoScaling(false), autoScaleFactor(1.0), - minWidth(0), - minHeight(0), - keepAspectRatio(false), + baseWidth(0), + baseHeight(0), ignoreIdleCallbacks(false), waitingForClipboardData(false), waitingForClipboardEvents(false), @@ -186,9 +184,8 @@ Window::PrivateData::PrivateData(Application& a, Window* const s, scaleFactor(scale != 0.0 ? scale : DGL_NAMESPACE::getScaleFactor(view)), autoScaling(false), autoScaleFactor(1.0), - minWidth(0), - minHeight(0), - keepAspectRatio(false), + baseWidth(0), + baseHeight(0), ignoreIdleCallbacks(false), waitingForClipboardData(false), waitingForClipboardEvents(false), @@ -224,9 +221,8 @@ Window::PrivateData::PrivateData(Application& a, Window* const s, scaleFactor(scale != 0.0 ? scale : DGL_NAMESPACE::getScaleFactor(view)), autoScaling(false), autoScaleFactor(1.0), - minWidth(0), - minHeight(0), - keepAspectRatio(false), + baseWidth(0), + baseHeight(0), ignoreIdleCallbacks(false), waitingForClipboardData(false), waitingForClipboardEvents(false), @@ -526,7 +522,10 @@ bool Window::PrivateData::openFileBrowser(const FileBrowserOptions& options) fileBrowserHandle = fileBrowserCreate(isEmbed, puglGetNativeView(view), - autoScaling ? autoScaleFactor : scaleFactor, + #if DGL_ALLOW_DEPRECATED_METHODS + autoScaling ? autoScaleFactor : + #endif + scaleFactor, options2); return fileBrowserHandle != nullptr; @@ -552,7 +551,10 @@ bool Window::PrivateData::createWebView(const char* const url, const DGL_NAMESPA puglGetNativeView(view), initialWidth, initialHeight, - autoScaling ? autoScaleFactor : scaleFactor, + #if DGL_ALLOW_DEPRECATED_METHODS + autoScaling ? autoScaleFactor : + #endif + scaleFactor, options); return webViewHandle != nullptr; @@ -648,8 +650,8 @@ void Window::PrivateData::onPuglConfigure(const uint width, const uint height) if (autoScaling) { - const double scaleHorizontal = width / static_cast(minWidth); - const double scaleVertical = height / static_cast(minHeight); + const double scaleHorizontal = width / static_cast(baseWidth); + const double scaleVertical = height / static_cast(baseHeight); autoScaleFactor = scaleHorizontal < scaleVertical ? scaleHorizontal : scaleVertical; } else @@ -665,7 +667,10 @@ void Window::PrivateData::onPuglConfigure(const uint width, const uint height) webViewResize(webViewHandle, uwidth - webViewOffset.getX(), uheight - webViewOffset.getY(), - autoScaling ? autoScaleFactor : scaleFactor); + #if DGL_ALLOW_DEPRECATED_METHODS + autoScaling ? autoScaleFactor : + #endif + scaleFactor); #endif #if DGL_ALLOW_DEPRECATED_METHODS @@ -1089,12 +1094,14 @@ PuglStatus Window::PrivateData::puglEventCallback(PuglView* const view, const Pu ev.time = d_roundToUnsignedInt(event->button.time * 1000.0); ev.button = event->button.button + 1; ev.press = event->type == PUGL_BUTTON_PRESS; + #if DGL_ALLOW_DEPRECATED_METHODS if (pData->autoScaling && 0) { const double scaleFactor = pData->autoScaleFactor; ev.pos = Point(event->button.x / scaleFactor, event->button.y / scaleFactor); } else + #endif { ev.pos = Point(event->button.x, event->button.y); } @@ -1110,12 +1117,14 @@ PuglStatus Window::PrivateData::puglEventCallback(PuglView* const view, const Pu ev.mod = event->motion.state; ev.flags = event->motion.flags; ev.time = d_roundToUnsignedInt(event->motion.time * 1000.0); + #if DGL_ALLOW_DEPRECATED_METHODS if (pData->autoScaling && 0) { const double scaleFactor = pData->autoScaleFactor; ev.pos = Point(event->motion.x / scaleFactor, event->motion.y / scaleFactor); } else + #endif { ev.pos = Point(event->motion.x, event->motion.y); } @@ -1131,6 +1140,7 @@ PuglStatus Window::PrivateData::puglEventCallback(PuglView* const view, const Pu ev.mod = event->scroll.state; ev.flags = event->scroll.flags; ev.time = d_roundToUnsignedInt(event->scroll.time * 1000.0); + #if DGL_ALLOW_DEPRECATED_METHODS if (pData->autoScaling && 0) { const double scaleFactor = pData->autoScaleFactor; @@ -1138,6 +1148,7 @@ PuglStatus Window::PrivateData::puglEventCallback(PuglView* const view, const Pu ev.delta = Point(event->scroll.dx / scaleFactor, event->scroll.dy / scaleFactor); } else + #endif { ev.pos = Point(event->scroll.x, event->scroll.y); ev.delta = Point(event->scroll.dx, event->scroll.dy); diff --git a/dpf/dgl/src/WindowPrivateData.hpp b/dpf/dgl/src/WindowPrivateData.hpp index 3883184..34b279c 100644 --- a/dpf/dgl/src/WindowPrivateData.hpp +++ b/dpf/dgl/src/WindowPrivateData.hpp @@ -1,6 +1,6 @@ /* * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2025 Filipe Coelho + * Copyright (C) 2012-2026 Filipe Coelho * * Permission to use, copy, modify, and/or distribute this software for any purpose with * or without fee is hereby granted, provided that the above copyright notice and this @@ -76,10 +76,7 @@ struct Window::PrivateData : IdleCallback { /** Automatic scaling to apply on widgets, implemented internally. */ bool autoScaling; double autoScaleFactor; - - /** Pugl geometry constraints access. */ - uint minWidth, minHeight; - bool keepAspectRatio; + uint baseWidth, baseHeight; /** Whether to ignore idle callback requests, useful for temporary windows. */ bool ignoreIdleCallbacks; diff --git a/dpf/dgl/src/nanovg/stb_image.h b/dpf/dgl/src/nanovg/stb_image.h index e06f7a1..b5a7938 100644 --- a/dpf/dgl/src/nanovg/stb_image.h +++ b/dpf/dgl/src/nanovg/stb_image.h @@ -4395,7 +4395,7 @@ static int stbi__parse_png_file(stbi__png *z, int scan, int req_comp) if (!(s->img_n & 1)) return stbi__err("tRNS with alpha","Corrupt PNG"); if (c.length != (stbi__uint32) s->img_n*2) return stbi__err("bad tRNS len","Corrupt PNG"); has_trans = 1; - for (k=0; k < s->img_n; ++k) + for (k=0; k < s->img_n && k < 3; ++k) tc[k] = (stbi_uc) (stbi__get16be(s) & 255) * stbi__depth_scale_table[depth]; // non 8-bit images will be larger } break; diff --git a/dpf/dgl/src/pugl-upstream/.clang-format b/dpf/dgl/src/pugl-upstream/.clang-format deleted file mode 100644 index 299c8a2..0000000 --- a/dpf/dgl/src/pugl-upstream/.clang-format +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright 2020-2025 David Robillard -# SPDX-License-Identifier: 0BSD OR ISC - ---- -AlignConsecutiveAssignments: true -AlignConsecutiveDeclarations: true -AlignEscapedNewlines: Left -AttributeMacros: - - PUGL_API - - PUGL_CONST_API - - PUGL_CONST_FUNC - - PUGL_MALLOC_API - - PUGL_MALLOC_FUNC - - PUGL_WARN_UNUSED_RESULT -BasedOnStyle: Mozilla -BraceWrapping: - AfterNamespace: false - AfterClass: true - AfterEnum: false - AfterExternBlock: false - AfterFunction: true - AfterStruct: false - SplitEmptyFunction: false - SplitEmptyRecord: false -BreakBeforeBraces: Custom -Cpp11BracedListStyle: true -IndentCaseLabels: false -IndentPPDirectives: AfterHash -KeepEmptyLinesAtTheStartOfBlocks: false -SpacesInContainerLiterals: false -StatementMacros: - - PUGL_UNUSED -... diff --git a/dpf/dgl/src/pugl-upstream/.clang-format-ignore b/dpf/dgl/src/pugl-upstream/.clang-format-ignore deleted file mode 100644 index 8e58ff4..0000000 --- a/dpf/dgl/src/pugl-upstream/.clang-format-ignore +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright 2025 David Robillard -# SPDX-License-Identifier: 0BSD OR ISC - -examples/glad/ diff --git a/dpf/dgl/src/pugl-upstream/.clang-tidy b/dpf/dgl/src/pugl-upstream/.clang-tidy deleted file mode 100644 index 5ce7497..0000000 --- a/dpf/dgl/src/pugl-upstream/.clang-tidy +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright 2020-2025 David Robillard -# SPDX-License-Identifier: 0BSD OR ISC - -Checks: > - *, - -*-magic-numbers, - -altera*, - -bugprone-assignment-in-if-condition, - -bugprone-switch-missing-default-case, - -clang-diagnostic-unused-function, - -clang-diagnostic-unused-macros, - -llvmlibc-*, - -misc-include-cleaner, - -readability-avoid-nested-conditional-operator, - -readability-identifier-length, - -readability-implicit-bool-conversion, -CheckOptions: - - key: hicpp-uppercase-literal-suffix.NewSuffixes - value: L;U;f - - key: readability-uppercase-literal-suffix.NewSuffixes - value: L;U;f -FormatStyle: file -HeaderFilterRegex: 'pugl/.*' diff --git a/dpf/dgl/src/pugl-upstream/.gitignore b/dpf/dgl/src/pugl-upstream/.gitignore deleted file mode 100644 index 6599d15..0000000 --- a/dpf/dgl/src/pugl-upstream/.gitignore +++ /dev/null @@ -1,10 +0,0 @@ -# Copyright 2021-2023 David Robillard -# SPDX-License-Identifier: 0BSD OR ISC - -*.pyc -.meson-subproject-wrap-hash.txt -__pycache__ -build/ -subprojects/packagecache/ -subprojects/sphinxygen-1.0.0/ -subprojects/sphinxygen/ diff --git a/dpf/dgl/src/pugl-upstream/.gitlab-ci.yml b/dpf/dgl/src/pugl-upstream/.gitlab-ci.yml deleted file mode 100644 index 95f8ee6..0000000 --- a/dpf/dgl/src/pugl-upstream/.gitlab-ci.yml +++ /dev/null @@ -1,119 +0,0 @@ -# Copyright 2018-2022 David Robillard -# SPDX-License-Identifier: 0BSD OR ISC - -stages: [build, deploy] - -default: - stage: build - image: lv2plugin/debian-x64 - script: - - meson setup build -Dwerror=true - - ninja -C build - -dev: - stage: build - image: lv2plugin/debian-x64 - script: - - meson setup build -Dbuildtype=debug -Ddocs=enabled -Ddocs_cpp=false -Dwarning_level=3 -Dwerror=true -Dlint=true - - ninja -C build - - meson configure -Dbuildtype=release build - - ninja -C build - artifacts: - paths: - - build/doc - -static: - stage: build - image: lv2plugin/debian-x64 - script: - - meson setup build -Ddefault_library=static -Ddocs=disabled -Dwarning_level=3 -Dwerror=true - - ninja -C build - - meson configure -Dbuildtype=release build - - ninja -C build - -# Linux Platforms - -arm32: - stage: build - image: lv2plugin/debian-arm32 - script: - - meson setup build --cross-file=/usr/share/meson/cross/arm-linux-gnueabihf.ini -Dbuildtype=debug -Ddocs=disabled -Dwarning_level=3 -Dwerror=true - - ninja -C build - - meson configure -Dbuildtype=release build - - ninja -C build - -arm64: - stage: build - image: lv2plugin/debian-arm64 - script: - - meson setup build --cross-file=/usr/share/meson/cross/aarch64-linux-gnu.ini -Dbuildtype=debug -Ddocs=disabled -Dwarning_level=3 -Dwerror=true - - ninja -C build - - meson configure -Dbuildtype=release build - - ninja -C build - -mingw32: - stage: build - image: lv2plugin/debian-mingw32 - script: - - meson setup build --cross-file=/usr/share/meson/cross/i686-w64-mingw32.ini -Dbuildtype=debug -Ddocs=disabled -Dwarning_level=everything -Dwerror=true - - ninja -C build - - meson configure -Dbuildtype=release build - - ninja -C build - variables: - WINEPATH: "Z:\\usr\\lib\\gcc\\i686-w64-mingw32\\10-win32" - -mingw64: - stage: build - image: lv2plugin/debian-mingw64 - script: - - meson setup build --cross-file=/usr/share/meson/cross/x86_64-w64-mingw32.ini -Dbuildtype=debug -Ddocs=disabled -Dwarning_level=everything -Dwerror=true - - ninja -C build - - meson configure -Dbuildtype=release build - - ninja -C build - -# Linux Distributions - -fedora: - stage: build - image: lv2plugin/fedora-big - script: - - meson setup build -Dbuildtype=plain -Dwarning_level=3 -Dwerror=true - - ninja -C build - variables: - CFLAGS: -O2 -D_FORTIFY_SOURCE=2 - -# Non-Linux/Docker rows (not hosted) - -mac: - stage: build - tags: [macos] - script: - - meson setup build -Dbuildtype=debug -Ddocs=disabled -Dwarning_level=everything -Dwerror=true - - ninja -C build - - meson configure -Dbuildtype=release build - - ninja -C build - -win: - stage: build - tags: [windows,meson] - script: - - meson setup build -Dbuildtype=debug -Ddocs=disabled -Dwarning_level=everything -Dwerror=true - - ninja -C build - - meson configure -Dbuildtype=release build - - ninja -C build - -pages: - stage: deploy - script: - - mkdir public - - mkdir public/c - - mkdir public/cpp - - mv build/doc/c/singlehtml/ public/c/singlehtml/ - - mv build/doc/c/html/ public/c/html/ - needs: - - dev - artifacts: - paths: - - public - only: - - main diff --git a/dpf/dgl/src/pugl-upstream/include/meson.build b/dpf/dgl/src/pugl-upstream/include/meson.build deleted file mode 100644 index 3d838ca..0000000 --- a/dpf/dgl/src/pugl-upstream/include/meson.build +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright 2021-2023 David Robillard -# SPDX-License-Identifier: 0BSD OR ISC - -c_headers = files( - 'pugl/attributes.h', - 'pugl/cairo.h', - 'pugl/gl.h', - 'pugl/glu.h', - 'pugl/pugl.h', - 'pugl/stub.h', - 'pugl/vulkan.h', -) - -install_headers(c_headers, subdir: versioned_name / 'pugl') diff --git a/dpf/dgl/src/pugl-upstream/src/.clang-tidy b/dpf/dgl/src/pugl-upstream/src/.clang-tidy deleted file mode 100644 index cfc824d..0000000 --- a/dpf/dgl/src/pugl-upstream/src/.clang-tidy +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright 2020-2024 David Robillard -# SPDX-License-Identifier: 0BSD OR ISC - -Checks: > - -bugprone-easily-swappable-parameters, - -bugprone-multi-level-implicit-pointer-conversion, - -hicpp-multiway-paths-covered, - -hicpp-signed-bitwise, - -llvm-header-guard, - -readability-function-cognitive-complexity, -InheritParentConfig: true diff --git a/dpf/dgl/src/pugl.cpp b/dpf/dgl/src/pugl.cpp index fda302d..59f0bc7 100644 --- a/dpf/dgl/src/pugl.cpp +++ b/dpf/dgl/src/pugl.cpp @@ -308,6 +308,11 @@ PuglStatus puglSetGeometryConstraints(PuglView* const view, const uint width, co view->sizeHints[PUGL_FIXED_ASPECT].width = static_cast(width); view->sizeHints[PUGL_FIXED_ASPECT].height = static_cast(height); } + else + { + view->sizeHints[PUGL_FIXED_ASPECT].width = 0; + view->sizeHints[PUGL_FIXED_ASPECT].height = 0; + } #if defined(DISTRHO_OS_HAIKU) #elif defined(DISTRHO_OS_MAC) diff --git a/dpf/dgl/src/resources/DejaVuSans.ttf b/dpf/dgl/src/resources/DejaVuSans.ttf deleted file mode 100644 index 9d40c32..0000000 Binary files a/dpf/dgl/src/resources/DejaVuSans.ttf and /dev/null differ diff --git a/dpf/distrho/DistrhoUI.hpp b/dpf/distrho/DistrhoUI.hpp index 2401197..10bc7c3 100644 --- a/dpf/distrho/DistrhoUI.hpp +++ b/dpf/distrho/DistrhoUI.hpp @@ -1,6 +1,6 @@ /* * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2025 Filipe Coelho + * Copyright (C) 2012-2026 Filipe Coelho * * Permission to use, copy, modify, and/or distribute this software for any purpose with * or without fee is hereby granted, provided that the above copyright notice and this @@ -55,7 +55,7 @@ START_NAMESPACE_DISTRHO class PluginWindow; -/* ------------------------------------------------------------------------------------------------------------ +/* -------------------------------------------------------------------------------------------------------------------- * DPF UI */ /** @@ -72,23 +72,38 @@ class PluginWindow; class UI : public UIWidget { public: + enum InternalScalingMode { + kNoInternalScaling, + kInternalScalingMatchingHost, + }; + /** UI class constructor. The UI should be initialized to a default state that matches the plugin side. - When @a automaticallyScale is set to true, DPF will automatically scale up the UI - to fit the host/desktop scale factor.@n - It assumes aspect ratio is meant to be kept. - Manually call setGeometryConstraints instead if keeping UI aspect ratio is not required. + The @p width and @p height arguments are meant to be used without any OS-level UI scaling. + Scaling will be automatically done internally if needed, matching the OS and host. + + @see getScaleFactor + @see setGeometryConstraints + */ + UI(uint width = 0, uint height = 0, InternalScalingMode internalScalingMode = kNoInternalScaling); + + #if DGL_ALLOW_DEPRECATED_METHODS + /** DEPRECATED DO NOT USE. + * The old deprecated constructor allowed for an optional `bool automaticallyScaleAndSetAsMinimumSize`. + * This turned out to be not be a good idea; now the scaling is done automatically while minimum size is not. */ - UI(uint width = 0, uint height = 0, bool automaticallyScaleAndSetAsMinimumSize = false); + DISTRHO_DEPRECATED_BY("UI(width, height)") + UI(uint width, uint height, bool automaticallyScaleAndSetAsMinimumSize); + #endif /** Destructor. */ ~UI() override; - /* -------------------------------------------------------------------------------------------------------- + /* ----------------------------------------------------------------------------------------------------------------- * Host state */ /** @@ -201,7 +216,7 @@ public: #endif #if DISTRHO_PLUGIN_WANT_DIRECT_ACCESS - /* -------------------------------------------------------------------------------------------------------- + /* ----------------------------------------------------------------------------------------------------------------- * Direct DSP access - DO NOT USE THIS UNLESS STRICTLY NECESSARY!! */ /** @@ -212,7 +227,7 @@ public: #endif protected: - /* -------------------------------------------------------------------------------------------------------- + /* ----------------------------------------------------------------------------------------------------------------- * DSP/Plugin Callbacks */ /** @@ -237,7 +252,7 @@ protected: virtual void stateChanged(const char* key, const char* value); #endif - /* -------------------------------------------------------------------------------------------------------- + /* ----------------------------------------------------------------------------------------------------------------- * DSP/Plugin Callbacks (optional) */ /** @@ -246,7 +261,7 @@ protected: */ virtual void sampleRateChanged(double newSampleRate); - /* -------------------------------------------------------------------------------------------------------- + /* ----------------------------------------------------------------------------------------------------------------- * UI Callbacks (optional) */ /** @@ -310,7 +325,7 @@ protected: virtual void uiFileBrowserSelected(const char* filename); #endif - /* -------------------------------------------------------------------------------------------------------- + /* ----------------------------------------------------------------------------------------------------------------- * UI Resize Handling, internal */ /** @@ -320,7 +335,7 @@ protected: */ void onResize(const ResizeEvent& ev) override; - // ------------------------------------------------------------------------------------------------------- + // ---------------------------------------------------------------------------------------------------------------- private: struct PrivateData; @@ -335,7 +350,7 @@ private: /** @} */ -/* ------------------------------------------------------------------------------------------------------------ +/* -------------------------------------------------------------------------------------------------------------------- * Create UI, entry point */ /** @@ -351,7 +366,7 @@ extern UI* createUI(); /** @} */ -// ----------------------------------------------------------------------------------------------------------- +// -------------------------------------------------------------------------------------------------------------------- END_NAMESPACE_DISTRHO diff --git a/dpf/distrho/extra/String.hpp b/dpf/distrho/extra/String.hpp index 7364662..3f16895 100644 --- a/dpf/distrho/extra/String.hpp +++ b/dpf/distrho/extra/String.hpp @@ -695,7 +695,7 @@ public: "abcdefghijklmnopqrstuvwxyz" "0123456789+/"; - const size_t strBufSize = std::min(d_nextPowerOf2(static_cast(dataSize/3)), 65536U); + const size_t strBufSize = std::min(d_nextPowerOf2(static_cast(dataSize / 3) + 1), 65536U); char* strBuf = static_cast(std::malloc(strBufSize)); DISTRHO_SAFE_ASSERT_RETURN(strBuf != nullptr, String()); diff --git a/dpf/distrho/extra/ValueSmoother.hpp b/dpf/distrho/extra/ValueSmoother.hpp deleted file mode 100644 index 75f3169..0000000 --- a/dpf/distrho/extra/ValueSmoother.hpp +++ /dev/null @@ -1,204 +0,0 @@ -/* - * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2021 Jean Pierre Cimalando - * Copyright (C) 2021-2023 Filipe Coelho - * - * Permission to use, copy, modify, and/or distribute this software for any purpose with - * or without fee is hereby granted, provided that the above copyright notice and this - * permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN - * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER - * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef DISTRHO_VALUE_SMOOTHER_HPP_INCLUDED -#define DISTRHO_VALUE_SMOOTHER_HPP_INCLUDED - -#include "../DistrhoUtils.hpp" - -START_NAMESPACE_DISTRHO - -// -------------------------------------------------------------------------------------------------------------------- - -/** - * @brief An exponential smoother for control values - * - * This continually smooths a value towards a defined target, - * using a low-pass filter of the 1st order, which creates an exponential curve. - * - * The length of the curve is defined by a T60 constant, - * which is the time it takes for a 1-to-0 smoothing to fall to -60dB. - * - * Note that this smoother has asymptotical behavior, - * and it must not be assumed that the final target is ever reached. - */ -class ExponentialValueSmoother { - float coef; - float target; - float mem; - float tau; - float sampleRate; - -public: - ExponentialValueSmoother() - : coef(0.f), - target(0.f), - mem(0.f), - tau(0.f), - sampleRate(0.f) {} - - void setSampleRate(const float newSampleRate) noexcept - { - if (d_isNotEqual(sampleRate, newSampleRate)) - { - sampleRate = newSampleRate; - updateCoef(); - } - } - - void setTimeConstant(const float newT60) noexcept - { - const float newTau = newT60 * (float)(1.0 / 6.91); - - if (d_isNotEqual(tau, newTau)) - { - tau = newTau; - updateCoef(); - } - } - - float getCurrentValue() const noexcept - { - return mem; - } - - float getTargetValue() const noexcept - { - return target; - } - - void setTargetValue(const float newTarget) noexcept - { - target = newTarget; - } - - void clearToTargetValue() noexcept - { - mem = target; - } - - inline float peek() const noexcept - { - return mem * coef + target * (1.f - coef); - } - - inline float next() noexcept - { - return (mem = mem * coef + target * (1.f - coef)); - } - -private: - void updateCoef() noexcept - { - coef = std::exp(-1.f / (tau * sampleRate)); - } -}; - -// -------------------------------------------------------------------------------------------------------------------- - -/** - * @brief A linear smoother for control values - * - * This continually smooths a value towards a defined target, using linear segments. - * - * The duration of the smoothing segment is defined by the given time constant. - * Every time the target changes, a new segment restarts for the whole duration of the time constant. - * - * Note that this smoother, unlike an exponential smoother, eventually should converge to its target value. - */ -class LinearValueSmoother { - float step; - float target; - float mem; - float tau; - float sampleRate; - -public: - LinearValueSmoother() - : step(0.f), - target(0.f), - mem(0.f), - tau(0.f), - sampleRate(0.f) {} - - void setSampleRate(const float newSampleRate) noexcept - { - if (d_isNotEqual(sampleRate, newSampleRate)) - { - sampleRate = newSampleRate; - updateStep(); - } - } - - void setTimeConstant(const float newTau) noexcept - { - if (d_isNotEqual(tau, newTau)) - { - tau = newTau; - updateStep(); - } - } - - float getCurrentValue() const noexcept - { - return mem; - } - - float getTargetValue() const noexcept - { - return target; - } - - void setTargetValue(const float newTarget) noexcept - { - if (d_isNotEqual(target, newTarget)) - { - target = newTarget; - updateStep(); - } - } - - void clearToTargetValue() noexcept - { - mem = target; - } - - inline float peek() const noexcept - { - const float dy = target - mem; - return mem + std::copysign(std::fmin(std::abs(dy), step), dy); - } - - inline float next() noexcept - { - const float y0 = mem; - const float dy = target - y0; - return (mem = y0 + std::copysign(std::fmin(std::abs(dy), step), dy)); - } - -private: - void updateStep() noexcept - { - step = std::abs(target - mem) / (tau * sampleRate); - } -}; - -// -------------------------------------------------------------------------------------------------------------------- - -END_NAMESPACE_DISTRHO - -#endif // DISTRHO_VALUE_SMOOTHER_HPP_INCLUDED diff --git a/dpf/distrho/src/DistrhoPluginMAPI.cpp b/dpf/distrho/src/DistrhoPluginMAPI.cpp index 9de5088..e1defb2 100644 --- a/dpf/distrho/src/DistrhoPluginMAPI.cpp +++ b/dpf/distrho/src/DistrhoPluginMAPI.cpp @@ -64,6 +64,11 @@ public: updateParameterOutputsAndTriggers(); } + float getParameter(unsigned int index) const + { + return fPlugin.getParameterValue(index); + } + void setParameter(unsigned int index, float value) { fPlugin.setParameterValue(index, fPlugin.getParameterRanges(index).getFixedValue(value)); @@ -135,6 +140,12 @@ void mapi_process(mapi_handle_t handle, static_cast(handle)->process(ins, outs, frames); } +MAPI_EXPORT +float mapi_get_parameter(mapi_handle_t handle, unsigned int index) +{ + return static_cast(handle)->getParameter(index); +} + MAPI_EXPORT void mapi_set_parameter(mapi_handle_t handle, unsigned int index, float value) { diff --git a/dpf/distrho/src/DistrhoUI.cpp b/dpf/distrho/src/DistrhoUI.cpp index 09b4a4d..c437995 100644 --- a/dpf/distrho/src/DistrhoUI.cpp +++ b/dpf/distrho/src/DistrhoUI.cpp @@ -1,6 +1,6 @@ /* * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2024 Filipe Coelho + * Copyright (C) 2012-2026 Filipe Coelho * * Permission to use, copy, modify, and/or distribute this software for any purpose with * or without fee is hereby granted, provided that the above copyright notice and this @@ -180,7 +180,7 @@ PluginWindow& UI::PrivateData::createNextWindow(UI* const ui, uint width, uint h UI::PrivateData* const uiData = s_nextPrivateData; const double scaleFactor = d_isNotZero(uiData->scaleFactor) ? uiData->scaleFactor : getDesktopScaleFactor(uiData->winId); - if (d_isNotZero(scaleFactor) && d_isNotEqual(scaleFactor, 1.0)) + if (d_isNotEqual(scaleFactor, 1.0)) { width *= scaleFactor; height *= scaleFactor; @@ -322,6 +322,35 @@ void UI::PrivateData::webViewMessageCallback(void* const arg, char* const msg) /* ------------------------------------------------------------------------------------------------------------ * UI */ +UI::UI(const uint width, const uint height, const InternalScalingMode internalScalingMode) + : UIWidget(UI::PrivateData::createNextWindow(this, + // width + #ifdef DISTRHO_UI_DEFAULT_WIDTH + width == 0 ? DISTRHO_UI_DEFAULT_WIDTH : + #endif + width, + // height + #ifdef DISTRHO_UI_DEFAULT_HEIGHT + height == 0 ? DISTRHO_UI_DEFAULT_HEIGHT : + #endif + height + )), + uiData(UI::PrivateData::s_nextPrivateData) +{ + if (width != 0 && height != 0) + { + if (internalScalingMode == kInternalScalingMatchingHost) + { + d_stdout("enableInternalScalingWithSize %u %u", width, height); + getWindow().enableInternalScalingWithSize(width, height, true); + return; + } + } + + Widget::setSize(getWindow().getSize()); +} + +#if DGL_ALLOW_DEPRECATED_METHODS UI::UI(const uint width, const uint height, const bool automaticallyScaleAndSetAsMinimumSize) : UIWidget(UI::PrivateData::createNextWindow(this, // width @@ -342,7 +371,26 @@ UI::UI(const uint width, const uint height, const bool automaticallyScaleAndSetA Widget::setSize(width, height); if (automaticallyScaleAndSetAsMinimumSize) - setGeometryConstraints(width, height, true, true, true); + { + #if defined(_MSC_VER) + #pragma warning(push) + #pragma warning(disable:4996) + #elif defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wdeprecated-declarations" + #elif defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 460 + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wdeprecated-declarations" + #endif + setGeometryConstraints(width, height, true, true, false); + #if defined(_MSC_VER) + #pragma warning(pop) + #elif defined(__clang__) + #pragma clang diagnostic pop + #elif defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 460 + #pragma GCC diagnostic pop + #endif + } } #ifdef DISTRHO_UI_DEFAULT_WIDTH else @@ -351,6 +399,7 @@ UI::UI(const uint width, const uint height, const bool automaticallyScaleAndSetA } #endif } +#endif UI::~UI() { diff --git a/dpf/distrho/src/mapi/mapi.h b/dpf/distrho/src/mapi/mapi.h index 88c3aa8..4bb8af5 100644 --- a/dpf/distrho/src/mapi/mapi.h +++ b/dpf/distrho/src/mapi/mapi.h @@ -43,6 +43,15 @@ void mapi_process(mapi_handle_t handle, float** outs, unsigned int frames); +/** + Get an effect parameter. + @param handle A previously created effect. + @param index A known index for this effect. + @return value A full-ranged value. +*/ +MAPI_EXPORT +float mapi_get_parameter(mapi_handle_t handle, unsigned int index); + /** Set an effect parameter. @param handle A previously created effect. diff --git a/dpf/dpf.doxygen b/dpf/dpf.doxygen deleted file mode 100644 index 01ae0f1..0000000 --- a/dpf/dpf.doxygen +++ /dev/null @@ -1,309 +0,0 @@ -# Doxyfile 1.7.6.1 - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- -DOXYFILE_ENCODING = UTF-8 -PROJECT_NAME = "DISTRHO Plugin Framework" -PROJECT_NUMBER = -PROJECT_BRIEF = -PROJECT_LOGO = -OUTPUT_DIRECTORY = docs -CREATE_SUBDIRS = NO -OUTPUT_LANGUAGE = English -BRIEF_MEMBER_DESC = YES -REPEAT_BRIEF = YES -ABBREVIATE_BRIEF = -ALWAYS_DETAILED_SEC = NO -INLINE_INHERITED_MEMB = NO -FULL_PATH_NAMES = YES -STRIP_FROM_PATH = -STRIP_FROM_INC_PATH = -SHORT_NAMES = NO -JAVADOC_AUTOBRIEF = NO -QT_AUTOBRIEF = NO -MULTILINE_CPP_IS_BRIEF = NO -INHERIT_DOCS = YES -SEPARATE_MEMBER_PAGES = NO -TAB_SIZE = 4 -ALIASES = -TCL_SUBST = -OPTIMIZE_OUTPUT_FOR_C = NO -OPTIMIZE_OUTPUT_JAVA = NO -OPTIMIZE_FOR_FORTRAN = NO -OPTIMIZE_OUTPUT_VHDL = NO -EXTENSION_MAPPING = -BUILTIN_STL_SUPPORT = NO -CPP_CLI_SUPPORT = NO -SIP_SUPPORT = NO -IDL_PROPERTY_SUPPORT = YES -DISTRIBUTE_GROUP_DOC = NO -SUBGROUPING = YES -INLINE_GROUPED_CLASSES = NO -INLINE_SIMPLE_STRUCTS = NO -TYPEDEF_HIDES_STRUCT = YES -SYMBOL_CACHE_SIZE = 0 -LOOKUP_CACHE_SIZE = 0 -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- -EXTRACT_ALL = NO -EXTRACT_PRIVATE = NO -EXTRACT_STATIC = YES -EXTRACT_LOCAL_CLASSES = YES -EXTRACT_LOCAL_METHODS = YES -EXTRACT_ANON_NSPACES = NO -HIDE_UNDOC_MEMBERS = NO -HIDE_UNDOC_CLASSES = NO -HIDE_FRIEND_COMPOUNDS = NO -HIDE_IN_BODY_DOCS = NO -INTERNAL_DOCS = NO -CASE_SENSE_NAMES = YES -HIDE_SCOPE_NAMES = NO -SHOW_INCLUDE_FILES = YES -FORCE_LOCAL_INCLUDES = NO -INLINE_INFO = YES -SORT_MEMBER_DOCS = NO -SORT_BRIEF_DOCS = NO -SORT_MEMBERS_CTORS_1ST = NO -SORT_GROUP_NAMES = NO -SORT_BY_SCOPE_NAME = NO -STRICT_PROTO_MATCHING = NO -GENERATE_TODOLIST = YES -GENERATE_TESTLIST = YES -GENERATE_BUGLIST = YES -GENERATE_DEPRECATEDLIST= YES -ENABLED_SECTIONS = -MAX_INITIALIZER_LINES = 30 -SHOW_USED_FILES = YES -SHOW_DIRECTORIES = NO -SHOW_FILES = YES -SHOW_NAMESPACES = YES -FILE_VERSION_FILTER = -LAYOUT_FILE = -CITE_BIB_FILES = -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- -QUIET = NO -WARNINGS = YES -WARN_IF_UNDOCUMENTED = YES -WARN_IF_DOC_ERROR = YES -WARN_NO_PARAMDOC = NO -WARN_FORMAT = "$file:$line: $text" -WARN_LOGFILE = -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = distrho distrho/extra dgl -INPUT_ENCODING = UTF-8 -FILE_PATTERNS = -RECURSIVE = NO -EXCLUDE = -EXCLUDE_SYMLINKS = NO -EXCLUDE_PATTERNS = -EXCLUDE_SYMBOLS = -EXAMPLE_PATH = -EXAMPLE_PATTERNS = -EXAMPLE_RECURSIVE = NO -IMAGE_PATH = -INPUT_FILTER = -FILTER_PATTERNS = -FILTER_SOURCE_FILES = NO -FILTER_SOURCE_PATTERNS = -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- -SOURCE_BROWSER = NO -INLINE_SOURCES = NO -STRIP_CODE_COMMENTS = NO -REFERENCED_BY_RELATION = NO -REFERENCES_RELATION = NO -REFERENCES_LINK_SOURCE = YES -USE_HTAGS = NO -VERBATIM_HEADERS = YES -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- -ALPHABETICAL_INDEX = YES -COLS_IN_ALPHA_INDEX = 5 -IGNORE_PREFIX = -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- -GENERATE_HTML = YES -HTML_OUTPUT = . -HTML_FILE_EXTENSION = .html -HTML_HEADER = -HTML_FOOTER = -HTML_STYLESHEET = -HTML_EXTRA_FILES = -HTML_COLORSTYLE_HUE = 220 -HTML_COLORSTYLE_SAT = 100 -HTML_COLORSTYLE_GAMMA = 80 -HTML_TIMESTAMP = NO -HTML_ALIGN_MEMBERS = YES -HTML_DYNAMIC_SECTIONS = NO -GENERATE_DOCSET = NO -DOCSET_FEEDNAME = "Doxygen generated docs" -DOCSET_BUNDLE_ID = org.doxygen.Project -DOCSET_PUBLISHER_ID = org.doxygen.Publisher -DOCSET_PUBLISHER_NAME = Publisher -GENERATE_HTMLHELP = NO -CHM_FILE = -HHC_LOCATION = -GENERATE_CHI = NO -CHM_INDEX_ENCODING = -BINARY_TOC = NO -TOC_EXPAND = NO -GENERATE_QHP = NO -QCH_FILE = -QHP_NAMESPACE = org.doxygen.Project -QHP_VIRTUAL_FOLDER = doc -QHP_CUST_FILTER_NAME = -QHP_CUST_FILTER_ATTRS = -QHP_SECT_FILTER_ATTRS = -QHG_LOCATION = -GENERATE_ECLIPSEHELP = NO -ECLIPSE_DOC_ID = org.doxygen.Project -DISABLE_INDEX = NO -GENERATE_TREEVIEW = NO -ENUM_VALUES_PER_LINE = 4 -USE_INLINE_TREES = NO -TREEVIEW_WIDTH = 250 -EXT_LINKS_IN_WINDOW = NO -FORMULA_FONTSIZE = 10 -FORMULA_TRANSPARENT = YES -USE_MATHJAX = NO -MATHJAX_RELPATH = http://www.mathjax.org/mathjax -MATHJAX_EXTENSIONS = -SEARCHENGINE = YES -SERVER_BASED_SEARCH = NO -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- -GENERATE_LATEX = NO -LATEX_OUTPUT = latex -LATEX_CMD_NAME = latex -MAKEINDEX_CMD_NAME = makeindex -COMPACT_LATEX = NO -PAPER_TYPE = a4 -EXTRA_PACKAGES = -LATEX_HEADER = -LATEX_FOOTER = -PDF_HYPERLINKS = YES -USE_PDFLATEX = YES -LATEX_BATCHMODE = NO -LATEX_HIDE_INDICES = NO -LATEX_SOURCE_CODE = NO -LATEX_BIB_STYLE = plain -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- -GENERATE_RTF = NO -RTF_OUTPUT = rtf -COMPACT_RTF = NO -RTF_HYPERLINKS = NO -RTF_STYLESHEET_FILE = -RTF_EXTENSIONS_FILE = -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- -GENERATE_MAN = NO -MAN_OUTPUT = man -MAN_EXTENSION = .3 -MAN_LINKS = NO -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- -GENERATE_XML = NO -XML_OUTPUT = xml -XML_SCHEMA = -XML_DTD = -XML_PROGRAMLISTING = YES -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- -GENERATE_AUTOGEN_DEF = NO -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- -GENERATE_PERLMOD = NO -PERLMOD_LATEX = NO -PERLMOD_PRETTY = YES -PERLMOD_MAKEVAR_PREFIX = -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- -ENABLE_PREPROCESSING = YES -MACRO_EXPANSION = YES -EXPAND_ONLY_PREDEF = YES -SEARCH_INCLUDES = YES -INCLUDE_PATH = -INCLUDE_FILE_PATTERNS = -PREDEFINED = DOXYGEN \ - DEBUG \ - HAVE_CAIRO=1 \ - HAVE_OPENGL=1 \ - DISTRHO_PLUGIN_NAME="Plugin Name" \ - DISTRHO_PLUGIN_NUM_INPUTS=2 \ - DISTRHO_PLUGIN_NUM_OUTPUTS=2 \ - DISTRHO_PLUGIN_URI="urn:distrho:name" \ - DISTRHO_PLUGIN_HAS_UI=1 \ - DISTRHO_PLUGIN_HAS_EMBED_UI=1 \ - DISTRHO_PLUGIN_HAS_EXTERNAL_UI=1 \ - DISTRHO_PLUGIN_IS_RT_SAFE=1 \ - DISTRHO_PLUGIN_IS_SYNTH=1 \ - DISTRHO_PLUGIN_WANT_DIRECT_ACCESS=1 \ - DISTRHO_PLUGIN_WANT_LATENCY=1 \ - DISTRHO_PLUGIN_WANT_MIDI_INPUT=1 \ - DISTRHO_PLUGIN_WANT_MIDI_OUTPUT=1 \ - DISTRHO_PLUGIN_WANT_PARAMETER_VALUE_CHANGE_REQUEST=1 \ - DISTRHO_PLUGIN_WANT_PROGRAMS=1 \ - DISTRHO_PLUGIN_WANT_STATE=1 \ - DISTRHO_PLUGIN_WANT_TIMEPOS=1 \ - DISTRHO_PLUGIN_WANT_FULL_STATE=1 \ - DISTRHO_UI_USE_NANOVG=1 -EXPAND_AS_DEFINED = YES -SKIP_FUNCTION_MACROS = YES -#--------------------------------------------------------------------------- -# Configuration::additions related to external references -#--------------------------------------------------------------------------- -TAGFILES = -GENERATE_TAGFILE = -ALLEXTERNALS = NO -EXTERNAL_GROUPS = YES -PERL_PATH = /usr/bin/perl -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- -CLASS_DIAGRAMS = YES -MSCGEN_PATH = -HIDE_UNDOC_RELATIONS = YES -HAVE_DOT = NO -DOT_NUM_THREADS = 0 -DOT_FONTNAME = Helvetica -DOT_FONTSIZE = 10 -DOT_FONTPATH = -CLASS_GRAPH = YES -COLLABORATION_GRAPH = YES -GROUP_GRAPHS = YES -UML_LOOK = NO -TEMPLATE_RELATIONS = NO -INCLUDE_GRAPH = YES -INCLUDED_BY_GRAPH = YES -CALL_GRAPH = NO -CALLER_GRAPH = NO -GRAPHICAL_HIERARCHY = YES -DIRECTORY_GRAPH = YES -DOT_IMAGE_FORMAT = png -INTERACTIVE_SVG = NO -DOT_PATH = -DOTFILE_DIRS = -MSCFILE_DIRS = -DOT_GRAPH_MAX_NODES = 50 -MAX_DOT_GRAPH_DEPTH = 0 -DOT_TRANSPARENT = NO -DOT_MULTI_TARGETS = YES -GENERATE_LEGEND = YES -DOT_CLEANUP = YES diff --git a/dpf/dpf.kdev4 b/dpf/dpf.kdev4 deleted file mode 100644 index 86f9a94..0000000 --- a/dpf/dpf.kdev4 +++ /dev/null @@ -1,9 +0,0 @@ -[Project] -Manager=KDevGenericManager -Name=DPF - -[Filters] -Excludes=*/.*,*/*~,*/*.a - -[Project] -VersionControlSupport=kdevgit diff --git a/get-plugins.sh b/get-plugins.sh index 24e57cf..ebf00c8 100755 --- a/get-plugins.sh +++ b/get-plugins.sh @@ -35,6 +35,7 @@ mkdir plugins mv repos/DPF dpf rm -rf dpf/.git* rm -rf dpf/.travis* +rm -rf dpf/cmake rm -rf dpf/distrho/extra/choc rm -rf dpf/distrho/extra/sofd rm -rf dpf/dgl/pugl-extra @@ -46,11 +47,13 @@ rm -rf dpf/dgl/src/pugl-upstream/resources rm -rf dpf/dgl/src/pugl-upstream/scripts rm -rf dpf/dgl/src/pugl-upstream/subprojects rm -rf dpf/dgl/src/pugl-upstream/test -rm -rf dpf/cmake rm -rf dpf/examples rm -rf dpf/lac rm -rf dpf/tests +rm -f dpf/CMakeLists.txt rm -f dpf/Makefile +rm -f dpf/dpf.doxygen +rm -f dpf/dpf.kdev4 rm -f dpf/dgl/FileBrowserDialog.hpp rm -f dpf/dgl/Layout.hpp rm -f dpf/dgl/Vulkan.hpp @@ -59,6 +62,11 @@ rm -f dpf/dgl/src/Layout.cpp rm -f dpf/dgl/src/Stub.cpp rm -f dpf/dgl/src/Vulkan.cpp rm -f dpf/dgl/src/WebViewWin32.cpp +rm -f dpf/dgl/src/pugl-upstream/.clang* +rm -f dpf/dgl/src/pugl-upstream/.git* +rm -f dpf/dgl/src/pugl-upstream/include/meson.build +rm -f dpf/dgl/src/pugl-upstream/src/.clang* +rm -f dpf/dgl/src/resources/*.ttf rm -f dpf/distrho/extra/Base64.hpp rm -f dpf/distrho/extra/ChildProcess.hpp rm -f dpf/distrho/extra/ExternalWindow.hpp @@ -66,6 +74,7 @@ rm -f dpf/distrho/extra/FileBrowserDialog* rm -f dpf/distrho/extra/Filesystem.hpp rm -f dpf/distrho/extra/Runner.hpp rm -f dpf/distrho/extra/Time.hpp +rm -f dpf/distrho/extra/ValueSmoother.hpp rm -f dpf/distrho/extra/WebView* sed -i -e '/ $(BUILD_DIR)\/dgl\/Layout.cpp.o \\/d' dpf/dgl/Makefile diff --git a/plugins/3BandEQ/DistrhoPluginInfo.h b/plugins/3BandEQ/DistrhoPluginInfo.h index 1e10e27..c9dad45 100644 --- a/plugins/3BandEQ/DistrhoPluginInfo.h +++ b/plugins/3BandEQ/DistrhoPluginInfo.h @@ -1,6 +1,6 @@ /* * DISTRHO 3BandEQ Plugin, based on 3BandEQ by Michael Gruhn - * Copyright (C) 2012-2024 Filipe Coelho + * Copyright (C) 2012-2026 Filipe Coelho * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -17,6 +17,8 @@ #ifndef DISTRHO_PLUGIN_INFO_H_INCLUDED #define DISTRHO_PLUGIN_INFO_H_INCLUDED +#include "DistrhoArtwork3BandEQ.hpp" + #define DISTRHO_PLUGIN_BRAND "DISTRHO" #define DISTRHO_PLUGIN_NAME "3 Band EQ" #define DISTRHO_PLUGIN_URI "http://distrho.sf.net/plugins/3BandEQ" @@ -35,6 +37,9 @@ #define DISTRHO_PLUGIN_LV2_CATEGORY "lv2:EQPlugin" #define DISTRHO_PLUGIN_VST3_CATEGORIES "Fx|EQ" +#define DISTRHO_UI_DEFAULT_WIDTH DistrhoArtwork3BandEQ::backgroundWidth +#define DISTRHO_UI_DEFAULT_HEIGHT DistrhoArtwork3BandEQ::backgroundHeight + #define DPF_VST3_DONT_USE_BRAND_ID #endif // DISTRHO_PLUGIN_INFO_H_INCLUDED diff --git a/plugins/3BandEQ/DistrhoUI3BandEQ.cpp b/plugins/3BandEQ/DistrhoUI3BandEQ.cpp index 75956c7..e5f4fd5 100644 --- a/plugins/3BandEQ/DistrhoUI3BandEQ.cpp +++ b/plugins/3BandEQ/DistrhoUI3BandEQ.cpp @@ -1,6 +1,6 @@ /* * DISTRHO 3BandEQ Plugin, based on 3BandEQ by Michael Gruhn - * Copyright (C) 2012-2021 Filipe Coelho + * Copyright (C) 2012-2026 Filipe Coelho * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -24,7 +24,7 @@ namespace Art = DistrhoArtwork3BandEQ; // ----------------------------------------------------------------------- DistrhoUI3BandEQ::DistrhoUI3BandEQ() - : UI(Art::backgroundWidth, Art::backgroundHeight, true), + : UI(Art::backgroundWidth, Art::backgroundHeight, kInternalScalingMatchingHost), fImgBackground(Art::backgroundData, Art::backgroundWidth, Art::backgroundHeight, kImageFormatBGR), fAboutWindow(this) { diff --git a/plugins/3BandEQ/DistrhoUI3BandEQ.hpp b/plugins/3BandEQ/DistrhoUI3BandEQ.hpp index 8744114..82fd101 100644 --- a/plugins/3BandEQ/DistrhoUI3BandEQ.hpp +++ b/plugins/3BandEQ/DistrhoUI3BandEQ.hpp @@ -1,6 +1,6 @@ /* * DISTRHO 3BandEQ Plugin, based on 3BandEQ by Michael Gruhn - * Copyright (C) 2012-2015 Filipe Coelho + * Copyright (C) 2012-2026 Filipe Coelho * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,8 +20,6 @@ #include "DistrhoUI.hpp" #include "ImageWidgets.hpp" -#include "DistrhoArtwork3BandEQ.hpp" - START_NAMESPACE_DISTRHO // ----------------------------------------------------------------------- diff --git a/plugins/3BandSplitter/DistrhoPluginInfo.h b/plugins/3BandSplitter/DistrhoPluginInfo.h index ed3a7d2..88fc060 100644 --- a/plugins/3BandSplitter/DistrhoPluginInfo.h +++ b/plugins/3BandSplitter/DistrhoPluginInfo.h @@ -1,6 +1,6 @@ /* * DISTRHO 3BandSplitter Plugin, based on 3BandSplitter by Michael Gruhn - * Copyright (C) 2012-2024 Filipe Coelho + * Copyright (C) 2012-2026 Filipe Coelho * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -17,6 +17,8 @@ #ifndef DISTRHO_PLUGIN_INFO_H_INCLUDED #define DISTRHO_PLUGIN_INFO_H_INCLUDED +#include "DistrhoArtwork3BandSplitter.hpp" + #define DISTRHO_PLUGIN_BRAND "DISTRHO" #define DISTRHO_PLUGIN_NAME "3 Band Splitter" #define DISTRHO_PLUGIN_URI "http://distrho.sf.net/plugins/3BandSplitter" @@ -35,6 +37,9 @@ #define DISTRHO_PLUGIN_LV2_CATEGORY "lv2:EQPlugin" #define DISTRHO_PLUGIN_VST3_CATEGORIES "Fx|EQ" +#define DISTRHO_UI_DEFAULT_WIDTH DistrhoArtwork3BandSplitter::backgroundWidth +#define DISTRHO_UI_DEFAULT_HEIGHT DistrhoArtwork3BandSplitter::backgroundHeight + #define DPF_VST3_DONT_USE_BRAND_ID #endif // DISTRHO_PLUGIN_INFO_H_INCLUDED diff --git a/plugins/3BandSplitter/DistrhoUI3BandSplitter.cpp b/plugins/3BandSplitter/DistrhoUI3BandSplitter.cpp index 30dae47..a78e904 100644 --- a/plugins/3BandSplitter/DistrhoUI3BandSplitter.cpp +++ b/plugins/3BandSplitter/DistrhoUI3BandSplitter.cpp @@ -1,6 +1,6 @@ /* * DISTRHO 3BandSplitter Plugin, based on 3BandSplitter by Michael Gruhn - * Copyright (C) 2012-2021 Filipe Coelho + * Copyright (C) 2012-2026 Filipe Coelho * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -24,7 +24,7 @@ namespace Art = DistrhoArtwork3BandSplitter; // ----------------------------------------------------------------------- DistrhoUI3BandSplitter::DistrhoUI3BandSplitter() - : UI(Art::backgroundWidth, Art::backgroundHeight, true), + : UI(Art::backgroundWidth, Art::backgroundHeight, kInternalScalingMatchingHost), fImgBackground(Art::backgroundData, Art::backgroundWidth, Art::backgroundHeight, kImageFormatBGR), fAboutWindow(this) { diff --git a/plugins/3BandSplitter/DistrhoUI3BandSplitter.hpp b/plugins/3BandSplitter/DistrhoUI3BandSplitter.hpp index a3e731f..e5c18f9 100644 --- a/plugins/3BandSplitter/DistrhoUI3BandSplitter.hpp +++ b/plugins/3BandSplitter/DistrhoUI3BandSplitter.hpp @@ -1,6 +1,6 @@ /* * DISTRHO 3BandSplitter Plugin, based on 3BandSplitter by Michael Gruhn - * Copyright (C) 2012-2015 Filipe Coelho + * Copyright (C) 2012-2026 Filipe Coelho * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,8 +20,6 @@ #include "DistrhoUI.hpp" #include "ImageWidgets.hpp" -#include "DistrhoArtwork3BandSplitter.hpp" - START_NAMESPACE_DISTRHO // ----------------------------------------------------------------------- diff --git a/plugins/AmplitudeImposer/DistrhoPluginInfo.h b/plugins/AmplitudeImposer/DistrhoPluginInfo.h index 27e0dbb..f1881af 100644 --- a/plugins/AmplitudeImposer/DistrhoPluginInfo.h +++ b/plugins/AmplitudeImposer/DistrhoPluginInfo.h @@ -1,7 +1,7 @@ /* * DISTRHO AmplitudeImposer, a DPF'ied AmplitudeImposer. * Copyright (C) 2004 Niall Moody - * Copyright (C) 2015-2022 Filipe Coelho + * Copyright (C) 2015-2026 Filipe Coelho * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -25,6 +25,8 @@ #ifndef DISTRHO_PLUGIN_INFO_H_INCLUDED #define DISTRHO_PLUGIN_INFO_H_INCLUDED +#include "DistrhoArtworkAmplitudeImposer.hpp" + #define DISTRHO_PLUGIN_BRAND "DISTRHO" #define DISTRHO_PLUGIN_NAME "Amplitude Imposr" #define DISTRHO_PLUGIN_URI "http://www.niallmoody.com/ndcplugs/ampimposer.htm" @@ -36,6 +38,9 @@ #define DISTRHO_PLUGIN_NUM_OUTPUTS 2 #define DISTRHO_PLUGIN_WANT_PROGRAMS 1 +#define DISTRHO_UI_DEFAULT_WIDTH DistrhoArtworkAmplitudeImposer::backWidth +#define DISTRHO_UI_DEFAULT_HEIGHT DistrhoArtworkAmplitudeImposer::backHeight + #define DISTRHO_PLUGIN_CLAP_FEATURES "audio-effect", "utility", "stereo" #define DISTRHO_PLUGIN_LV2_CATEGORY "lv2:AmplifierPlugin" #define DISTRHO_PLUGIN_VST3_CATEGORIES "Fx|Dynamics|Stereo" diff --git a/plugins/AmplitudeImposer/DistrhoUIAmplitudeImposer.cpp b/plugins/AmplitudeImposer/DistrhoUIAmplitudeImposer.cpp index 2b16de0..b6d4a87 100644 --- a/plugins/AmplitudeImposer/DistrhoUIAmplitudeImposer.cpp +++ b/plugins/AmplitudeImposer/DistrhoUIAmplitudeImposer.cpp @@ -1,7 +1,7 @@ /* * DISTRHO AmplitudeImposer, a DPF'ied AmplitudeImposer. * Copyright (C) 2004 Niall Moody - * Copyright (C) 2015-2021 Filipe Coelho + * Copyright (C) 2015-2026 Filipe Coelho * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -32,7 +32,7 @@ namespace Art = DistrhoArtworkAmplitudeImposer; // ----------------------------------------------------------------------- DistrhoUIAmplitudeImposer::DistrhoUIAmplitudeImposer() - : UI(Art::backWidth, Art::backHeight, true), + : UI(Art::backWidth, Art::backHeight, kInternalScalingMatchingHost), fImgBackground(Art::backData, Art::backWidth, Art::backHeight, kImageFormatGrayscale) { // sliders diff --git a/plugins/AmplitudeImposer/DistrhoUIAmplitudeImposer.hpp b/plugins/AmplitudeImposer/DistrhoUIAmplitudeImposer.hpp index f736f1f..6b4958c 100644 --- a/plugins/AmplitudeImposer/DistrhoUIAmplitudeImposer.hpp +++ b/plugins/AmplitudeImposer/DistrhoUIAmplitudeImposer.hpp @@ -1,7 +1,7 @@ /* * DISTRHO AmplitudeImposer, a DPF'ied AmplitudeImposer. * Copyright (C) 2004 Niall Moody - * Copyright (C) 2015 Filipe Coelho + * Copyright (C) 2015-2026 Filipe Coelho * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -28,8 +28,6 @@ #include "DistrhoUI.hpp" #include "ImageWidgets.hpp" -#include "DistrhoArtworkAmplitudeImposer.hpp" - START_NAMESPACE_DISTRHO // ----------------------------------------------------------------------- diff --git a/plugins/CycleShifter/DistrhoPluginInfo.h b/plugins/CycleShifter/DistrhoPluginInfo.h index edc3583..b0e79b8 100644 --- a/plugins/CycleShifter/DistrhoPluginInfo.h +++ b/plugins/CycleShifter/DistrhoPluginInfo.h @@ -1,7 +1,7 @@ /* * DISTRHO CycleShifter, a DPF'ied CycleShifter. * Copyright (C) 2004 Niall Moody - * Copyright (C) 2015-2022 Filipe Coelho + * Copyright (C) 2015-2026 Filipe Coelho * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -25,6 +25,8 @@ #ifndef DISTRHO_PLUGIN_INFO_H_INCLUDED #define DISTRHO_PLUGIN_INFO_H_INCLUDED +#include "DistrhoArtworkCycleShifter.hpp" + #define DISTRHO_PLUGIN_BRAND "DISTRHO" #define DISTRHO_PLUGIN_NAME "Cycle Shifter" #define DISTRHO_PLUGIN_URI "http://www.niallmoody.com/ndcplugs/cycleshifter.htm" @@ -36,6 +38,9 @@ #define DISTRHO_PLUGIN_NUM_OUTPUTS 1 #define DISTRHO_PLUGIN_WANT_PROGRAMS 1 +#define DISTRHO_UI_DEFAULT_WIDTH DistrhoArtworkCycleShifter::backWidth +#define DISTRHO_UI_DEFAULT_HEIGHT DistrhoArtworkCycleShifter::backHeight + #define DISTRHO_PLUGIN_CLAP_FEATURES "audio-effect", "stereo" #define DISTRHO_PLUGIN_VST3_CATEGORIES "Fx|Stereo" diff --git a/plugins/CycleShifter/DistrhoUICycleShifter.cpp b/plugins/CycleShifter/DistrhoUICycleShifter.cpp index f175efc..5508cef 100644 --- a/plugins/CycleShifter/DistrhoUICycleShifter.cpp +++ b/plugins/CycleShifter/DistrhoUICycleShifter.cpp @@ -1,7 +1,7 @@ /* * DISTRHO CycleShifter, a DPF'ied CycleShifter. * Copyright (C) 2004 Niall Moody - * Copyright (C) 2015-2021 Filipe Coelho + * Copyright (C) 2015-2026 Filipe Coelho * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -32,7 +32,7 @@ namespace Art = DistrhoArtworkCycleShifter; // ----------------------------------------------------------------------- DistrhoUICycleShifter::DistrhoUICycleShifter() - : UI(Art::backWidth, Art::backHeight, true), + : UI(Art::backWidth, Art::backHeight, kInternalScalingMatchingHost), fImgBackground(Art::backData, Art::backWidth, Art::backHeight, kImageFormatGrayscale) { // sliders diff --git a/plugins/CycleShifter/DistrhoUICycleShifter.hpp b/plugins/CycleShifter/DistrhoUICycleShifter.hpp index 2b0466d..f717d14 100644 --- a/plugins/CycleShifter/DistrhoUICycleShifter.hpp +++ b/plugins/CycleShifter/DistrhoUICycleShifter.hpp @@ -1,7 +1,7 @@ /* * DISTRHO CycleShifter, a DPF'ied CycleShifter. * Copyright (C) 2004 Niall Moody - * Copyright (C) 2015 Filipe Coelho + * Copyright (C) 2015-2026 Filipe Coelho * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -28,8 +28,6 @@ #include "DistrhoUI.hpp" #include "ImageWidgets.hpp" -#include "DistrhoArtworkCycleShifter.hpp" - START_NAMESPACE_DISTRHO // ----------------------------------------------------------------------- diff --git a/plugins/MVerb/DistrhoPluginInfo.h b/plugins/MVerb/DistrhoPluginInfo.h index 5f6dd4c..0c4ede8 100644 --- a/plugins/MVerb/DistrhoPluginInfo.h +++ b/plugins/MVerb/DistrhoPluginInfo.h @@ -1,7 +1,7 @@ /* * DISTRHO MVerb, a DPF'ied MVerb. * Copyright (c) 2010 Martin Eastwood - * Copyright (C) 2015-2022 Filipe Coelho + * Copyright (C) 2015-2026 Filipe Coelho * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -19,6 +19,8 @@ #ifndef DISTRHO_PLUGIN_INFO_H_INCLUDED #define DISTRHO_PLUGIN_INFO_H_INCLUDED +#include "DistrhoArtworkMVerb.hpp" + #define DISTRHO_PLUGIN_BRAND "DISTRHO" #define DISTRHO_PLUGIN_NAME "MVerb" #define DISTRHO_PLUGIN_URI "http://distrho.sf.net/plugins/MVerb" @@ -30,6 +32,9 @@ #define DISTRHO_PLUGIN_NUM_OUTPUTS 2 #define DISTRHO_PLUGIN_WANT_PROGRAMS 1 +#define DISTRHO_UI_DEFAULT_WIDTH DistrhoArtworkMVerb::backgroundWidth +#define DISTRHO_UI_DEFAULT_HEIGHT DistrhoArtworkMVerb::backgroundHeight + #define DISTRHO_PLUGIN_CLAP_FEATURES "audio-effect", "reverb", "stereo" #define DISTRHO_PLUGIN_LV2_CATEGORY "lv2:ReverbPlugin" #define DISTRHO_PLUGIN_VST3_CATEGORIES "Fx|Reverb" diff --git a/plugins/MVerb/DistrhoUIMVerb.cpp b/plugins/MVerb/DistrhoUIMVerb.cpp index c9d152a..97c8fea 100644 --- a/plugins/MVerb/DistrhoUIMVerb.cpp +++ b/plugins/MVerb/DistrhoUIMVerb.cpp @@ -1,7 +1,7 @@ /* * DISTRHO MVerb, a DPF'ied MVerb. * Copyright (c) 2010 Martin Eastwood - * Copyright (C) 2015-2021 Filipe Coelho + * Copyright (C) 2015-2026 Filipe Coelho * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -28,7 +28,7 @@ using DGL::Color; // ----------------------------------------------------------------------- DistrhoUIMVerb::DistrhoUIMVerb() - : UI(Art::backgroundWidth, Art::backgroundHeight, true), + : UI(Art::backgroundWidth, Art::backgroundHeight, kInternalScalingMatchingHost), fImgBackground(Art::backgroundData, Art::backgroundWidth, Art::backgroundHeight, kImageFormatBGR) { // text diff --git a/plugins/MVerb/DistrhoUIMVerb.hpp b/plugins/MVerb/DistrhoUIMVerb.hpp index 8a845df..00abe3c 100644 --- a/plugins/MVerb/DistrhoUIMVerb.hpp +++ b/plugins/MVerb/DistrhoUIMVerb.hpp @@ -1,7 +1,7 @@ /* * DISTRHO MVerb, a DPF'ied MVerb. * Copyright (c) 2010 Martin Eastwood - * Copyright (C) 2015 Filipe Coelho + * Copyright (C) 2015-2026 Filipe Coelho * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -23,8 +23,6 @@ #include "NanoVG.hpp" #include "ImageWidgets.hpp" -#include "DistrhoArtworkMVerb.hpp" - #include using DGL::Image; diff --git a/plugins/Nekobi/DistrhoUINekobi.cpp b/plugins/Nekobi/DistrhoUINekobi.cpp index d308217..381c251 100644 --- a/plugins/Nekobi/DistrhoUINekobi.cpp +++ b/plugins/Nekobi/DistrhoUINekobi.cpp @@ -1,6 +1,6 @@ /* * DISTRHO Nekobi Plugin, based on Nekobee by Sean Bolton and others. - * Copyright (C) 2013-2022 Filipe Coelho + * Copyright (C) 2013-2026 Filipe Coelho * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -25,7 +25,7 @@ namespace Art = DistrhoArtworkNekobi; // ----------------------------------------------------------------------- DistrhoUINekobi::DistrhoUINekobi() - : UI(Art::backgroundWidth, Art::backgroundHeight, true), + : UI(Art::backgroundWidth, Art::backgroundHeight, kInternalScalingMatchingHost), fImgBackground(Art::backgroundData, Art::backgroundWidth, Art::backgroundHeight, kImageFormatBGR), fAboutWindow(this) { diff --git a/plugins/Nekobi/nekobee-src/nekobee_voice.c b/plugins/Nekobi/nekobee-src/nekobee_voice.c index 3266546..368c6ec 100644 --- a/plugins/Nekobi/nekobee-src/nekobee_voice.c +++ b/plugins/Nekobi/nekobee-src/nekobee_voice.c @@ -42,7 +42,7 @@ nekobee_voice_new() { nekobee_voice_t *voice; - voice = (nekobee_voice_t *)calloc(sizeof(nekobee_voice_t), 1); + voice = (nekobee_voice_t *)calloc(1, sizeof(nekobee_voice_t)); if (voice) { voice->status = XSYNTH_VOICE_OFF; } diff --git a/plugins/PingPongPan/DistrhoPluginInfo.h b/plugins/PingPongPan/DistrhoPluginInfo.h index 7402b54..5659a48 100644 --- a/plugins/PingPongPan/DistrhoPluginInfo.h +++ b/plugins/PingPongPan/DistrhoPluginInfo.h @@ -1,6 +1,6 @@ /* * DISTRHO PingPongPan Plugin, based on PingPongPan by Michael Gruhn - * Copyright (C) 2012-2024 Filipe Coelho + * Copyright (C) 2012-2026 Filipe Coelho * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -17,6 +17,8 @@ #ifndef DISTRHO_PLUGIN_INFO_H_INCLUDED #define DISTRHO_PLUGIN_INFO_H_INCLUDED +#include "DistrhoArtworkPingPongPan.hpp" + #define DISTRHO_PLUGIN_BRAND "DISTRHO" #define DISTRHO_PLUGIN_NAME "Ping Pong Pan" #define DISTRHO_PLUGIN_URI "http://distrho.sf.net/plugins/PingPongPan" @@ -35,6 +37,9 @@ #define DISTRHO_PLUGIN_LV2_CATEGORY "lv2:SpatialPlugin" #define DISTRHO_PLUGIN_VST3_CATEGORIES "Fx|Spatial" +#define DISTRHO_UI_DEFAULT_WIDTH DistrhoArtworkPingPongPan::backgroundWidth +#define DISTRHO_UI_DEFAULT_HEIGHT DistrhoArtworkPingPongPan::backgroundHeight + #define DPF_VST3_DONT_USE_BRAND_ID #endif // DISTRHO_PLUGIN_INFO_H_INCLUDED diff --git a/plugins/PingPongPan/DistrhoUIPingPongPan.cpp b/plugins/PingPongPan/DistrhoUIPingPongPan.cpp index 265cefe..194a5b2 100644 --- a/plugins/PingPongPan/DistrhoUIPingPongPan.cpp +++ b/plugins/PingPongPan/DistrhoUIPingPongPan.cpp @@ -1,6 +1,6 @@ /* * DISTRHO PingPongPan Plugin, based on PingPongPan by Michael Gruhn - * Copyright (C) 2012-2021 Filipe Coelho + * Copyright (C) 2012-2026 Filipe Coelho * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -24,7 +24,7 @@ namespace Art = DistrhoArtworkPingPongPan; // ----------------------------------------------------------------------- DistrhoUIPingPongPan::DistrhoUIPingPongPan() - : UI(Art::backgroundWidth, Art::backgroundHeight, true), + : UI(Art::backgroundWidth, Art::backgroundHeight, kInternalScalingMatchingHost), fImgBackground(Art::backgroundData, Art::backgroundWidth, Art::backgroundHeight, kImageFormatBGR), fAboutWindow(this) { diff --git a/plugins/PingPongPan/DistrhoUIPingPongPan.hpp b/plugins/PingPongPan/DistrhoUIPingPongPan.hpp index ac7e150..e58d44c 100644 --- a/plugins/PingPongPan/DistrhoUIPingPongPan.hpp +++ b/plugins/PingPongPan/DistrhoUIPingPongPan.hpp @@ -1,6 +1,6 @@ /* * DISTRHO PingPongPan Plugin, based on PingPongPan by Michael Gruhn - * Copyright (C) 2012-2015 Filipe Coelho + * Copyright (C) 2012-2026 Filipe Coelho * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,8 +20,6 @@ #include "DistrhoUI.hpp" #include "ImageWidgets.hpp" -#include "DistrhoArtworkPingPongPan.hpp" - START_NAMESPACE_DISTRHO // ----------------------------------------------------------------------- diff --git a/plugins/ProM/DistrhoPluginInfo.h b/plugins/ProM/DistrhoPluginInfo.h index eeb474f..dda5ed9 100644 --- a/plugins/ProM/DistrhoPluginInfo.h +++ b/plugins/ProM/DistrhoPluginInfo.h @@ -1,6 +1,6 @@ /* * DISTRHO ProM Plugin - * Copyright (C) 2015-2022 Filipe Coelho + * Copyright (C) 2015-2026 Filipe Coelho * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -27,6 +27,9 @@ #define DISTRHO_PLUGIN_NUM_OUTPUTS 2 #define DISTRHO_UI_USER_RESIZABLE 1 +#define DISTRHO_UI_DEFAULT_WIDTH 512 +#define DISTRHO_UI_DEFAULT_HEIGHT 512 + // required by projectM #define DISTRHO_PLUGIN_WANT_DIRECT_ACCESS 1 diff --git a/plugins/ProM/DistrhoUIProM.cpp b/plugins/ProM/DistrhoUIProM.cpp index 36264a4..a15f761 100644 --- a/plugins/ProM/DistrhoUIProM.cpp +++ b/plugins/ProM/DistrhoUIProM.cpp @@ -1,6 +1,6 @@ /* * DISTRHO ProM Plugin - * Copyright (C) 2015-2022 Filipe Coelho + * Copyright (C) 2015-2026 Filipe Coelho * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -33,16 +33,13 @@ START_NAMESPACE_DISTRHO // ----------------------------------------------------------------------- DistrhoUIProM::DistrhoUIProM() - : UI(512, 512), + : UI(), fPM(nullptr), fResizeHandle(this) { const double scaleFactor = getScaleFactor(); - if (d_isNotZero(scaleFactor)) - setSize(512*scaleFactor, 512*scaleFactor); - - setGeometryConstraints(256*scaleFactor, 256*scaleFactor, true); + setGeometryConstraints(256 * scaleFactor, 256 * scaleFactor, true); // no need to show resize handle if window is user-resizable // if (isResizable()) @@ -88,43 +85,43 @@ void DistrhoUIProM::uiIdle() } } -void DistrhoUIProM::uiReshape(const uint width, const uint height) -{ - UI::uiReshape(width, height); +// ----------------------------------------------------------------------- +// Widget Callbacks - if (fPM == nullptr) +void DistrhoUIProM::onDisplay() +{ + if (fResized) { + if (fPM == nullptr) + { #ifdef PROJECTM_DATA_DIR - fPM = new projectM(PROJECTM_DATA_DIR "/config.inp"); + fPM = new projectM(PROJECTM_DATA_DIR "/config.inp"); #else - if (const char* const bundlePath = getBundlePath()) - { - const String datadir(getResourcePath(bundlePath)); - d_stdout("ProM datadir: '%s'", datadir.buffer()); - - projectM::Settings settings; - settings.presetURL = datadir + DISTRHO_OS_SEP_STR "presets"; - settings.titleFontURL = datadir + DISTRHO_OS_SEP_STR "fonts" DISTRHO_OS_SEP_STR "Vera.ttf"; - settings.menuFontURL = datadir + DISTRHO_OS_SEP_STR "fonts" DISTRHO_OS_SEP_STR "VeraMono.ttf"; - settings.datadir = datadir; - fPM = new projectM(settings); - } - else - { - d_stderr2("ProM: failed to find bundle path, UI will be empty"); - } + if (const char* const bundlePath = getBundlePath()) + { + const String datadir(getResourcePath(bundlePath)); + d_stdout("ProM datadir: '%s'", datadir.buffer()); + + projectM::Settings settings; + settings.presetURL = datadir + DISTRHO_OS_SEP_STR "presets"; + settings.titleFontURL = datadir + DISTRHO_OS_SEP_STR "fonts" DISTRHO_OS_SEP_STR "Vera.ttf"; + settings.menuFontURL = datadir + DISTRHO_OS_SEP_STR "fonts" DISTRHO_OS_SEP_STR "VeraMono.ttf"; + settings.datadir = datadir; + fPM = new projectM(settings); + } + else + { + d_stderr2("ProM: failed to find bundle path, UI will be empty"); + } #endif - } + } - if (fPM != nullptr) - fPM->projectM_resetGL(width, height); -} + if (fPM != nullptr) + fPM->projectM_resetGL(getWidth(), getHeight()); -// ----------------------------------------------------------------------- -// Widget Callbacks + fResized = false; + } -void DistrhoUIProM::onDisplay() -{ if (fPM == nullptr) return; @@ -138,12 +135,6 @@ static projectMKeycode dgl2pmkey(const DGL_NAMESPACE::Key key) noexcept { switch (key) { - case DGL_NAMESPACE::kKeyBackspace: - return PROJECTM_K_BACKSPACE; - case DGL_NAMESPACE::kKeyEscape: - return PROJECTM_K_ESCAPE; - case DGL_NAMESPACE::kKeyDelete: - return PROJECTM_K_DELETE; case DGL_NAMESPACE::kKeyF1: return PROJECTM_K_F1; case DGL_NAMESPACE::kKeyF2: @@ -168,6 +159,14 @@ static projectMKeycode dgl2pmkey(const DGL_NAMESPACE::Key key) noexcept return PROJECTM_K_F11; case DGL_NAMESPACE::kKeyF12: return PROJECTM_K_F12; + case DGL_NAMESPACE::kKeyPageUp: + return PROJECTM_K_PAGEUP; + case DGL_NAMESPACE::kKeyPageDown: + return PROJECTM_K_PAGEDOWN; + case DGL_NAMESPACE::kKeyEnd: + return PROJECTM_K_END; + case DGL_NAMESPACE::kKeyHome: + return PROJECTM_K_HOME; case DGL_NAMESPACE::kKeyLeft: return PROJECTM_K_LEFT; case DGL_NAMESPACE::kKeyUp: @@ -176,14 +175,6 @@ static projectMKeycode dgl2pmkey(const DGL_NAMESPACE::Key key) noexcept return PROJECTM_K_RIGHT; case DGL_NAMESPACE::kKeyDown: return PROJECTM_K_DOWN; - case DGL_NAMESPACE::kKeyPageUp: - return PROJECTM_K_PAGEUP; - case DGL_NAMESPACE::kKeyPageDown: - return PROJECTM_K_PAGEDOWN; - case DGL_NAMESPACE::kKeyHome: - return PROJECTM_K_HOME; - case DGL_NAMESPACE::kKeyEnd: - return PROJECTM_K_END; case DGL_NAMESPACE::kKeyInsert: return PROJECTM_K_INSERT; case DGL_NAMESPACE::kKeyShiftL: @@ -192,17 +183,84 @@ static projectMKeycode dgl2pmkey(const DGL_NAMESPACE::Key key) noexcept return PROJECTM_K_RSHIFT; case DGL_NAMESPACE::kKeyControlL: return PROJECTM_K_LCTRL; + case DGL_NAMESPACE::kKeyPad0: + return PROJECTM_K_0; + case DGL_NAMESPACE::kKeyPad1: + return PROJECTM_K_1; + case DGL_NAMESPACE::kKeyPad2: + return PROJECTM_K_2; + case DGL_NAMESPACE::kKeyPad3: + return PROJECTM_K_3; + case DGL_NAMESPACE::kKeyPad4: + return PROJECTM_K_4; + case DGL_NAMESPACE::kKeyPad5: + return PROJECTM_K_5; + case DGL_NAMESPACE::kKeyPad6: + return PROJECTM_K_6; + case DGL_NAMESPACE::kKeyPad7: + return PROJECTM_K_7; + case DGL_NAMESPACE::kKeyPad8: + return PROJECTM_K_8; + case DGL_NAMESPACE::kKeyPad9: + return PROJECTM_K_9; + case DGL_NAMESPACE::kKeyPadEnter: + return PROJECTM_K_RETURN; + case DGL_NAMESPACE::kKeyPadPageUp: + return PROJECTM_K_PAGEUP; + case DGL_NAMESPACE::kKeyPadPageDown: + return PROJECTM_K_PAGEDOWN; + case DGL_NAMESPACE::kKeyPadEnd: + return PROJECTM_K_END; + case DGL_NAMESPACE::kKeyPadHome: + return PROJECTM_K_HOME; + case DGL_NAMESPACE::kKeyPadLeft: + return PROJECTM_K_LEFT; + case DGL_NAMESPACE::kKeyPadUp: + return PROJECTM_K_UP; + case DGL_NAMESPACE::kKeyPadRight: + return PROJECTM_K_RIGHT; + case DGL_NAMESPACE::kKeyPadDown: + return PROJECTM_K_DOWN; + case DGL_NAMESPACE::kKeyPadInsert: + return PROJECTM_K_INSERT; + case DGL_NAMESPACE::kKeyPadDelete: + return PROJECTM_K_DELETE; + case DGL_NAMESPACE::kKeyPadEqual: + return PROJECTM_K_EQUALS; + case DGL_NAMESPACE::kKeyPadAdd: + return PROJECTM_K_PLUS; + case DGL_NAMESPACE::kKeyPadSubtract: + return PROJECTM_K_MINUS; + + case DGL_NAMESPACE::kKeyBackspace: + return PROJECTM_K_BACKSPACE; + case DGL_NAMESPACE::kKeyTab: + // TODO + case DGL_NAMESPACE::kKeyEnter: + return PROJECTM_K_RETURN; + case DGL_NAMESPACE::kKeyEscape: + return PROJECTM_K_ESCAPE; + case DGL_NAMESPACE::kKeyDelete: + return PROJECTM_K_DELETE; + case DGL_NAMESPACE::kKeySpace: + break; + + case DGL_NAMESPACE::kKeyPrintScreen: + case DGL_NAMESPACE::kKeyPause: + case DGL_NAMESPACE::kKeyMenu: + case DGL_NAMESPACE::kKeyNumLock: + case DGL_NAMESPACE::kKeyScrollLock: + case DGL_NAMESPACE::kKeyCapsLock: case DGL_NAMESPACE::kKeyControlR: case DGL_NAMESPACE::kKeyAltL: case DGL_NAMESPACE::kKeyAltR: case DGL_NAMESPACE::kKeySuperL: case DGL_NAMESPACE::kKeySuperR: - case DGL_NAMESPACE::kKeyMenu: - case DGL_NAMESPACE::kKeyCapsLock: - case DGL_NAMESPACE::kKeyScrollLock: - case DGL_NAMESPACE::kKeyNumLock: - case DGL_NAMESPACE::kKeyPrintScreen: - case DGL_NAMESPACE::kKeyPause: + case DGL_NAMESPACE::kKeyPadClear: + case DGL_NAMESPACE::kKeyPadMultiply: + case DGL_NAMESPACE::kKeyPadSeparator: + case DGL_NAMESPACE::kKeyPadDecimal: + case DGL_NAMESPACE::kKeyPadDivide: break; } @@ -251,20 +309,28 @@ bool DistrhoUIProM::onKeyboard(const KeyboardEvent& ev) else { /* missing: - * PROJECTM_K_CAPSLOCK + * PROJECTM_K_TAB + * PROJECTM_K_SPACE */ switch (ev.key) { case DGL_NAMESPACE::kKeyBackspace: pmKey = PROJECTM_K_BACKSPACE; break; + case DGL_NAMESPACE::kKeyTab: + break; + case DGL_NAMESPACE::kKeyEnter: + pmKey = PROJECTM_K_RETURN; + break; case DGL_NAMESPACE::kKeyEscape: pmKey = PROJECTM_K_ESCAPE; break; case DGL_NAMESPACE::kKeyDelete: pmKey = PROJECTM_K_DELETE; break; - case '\r': + case DGL_NAMESPACE::kKeySpace: + break; + case '\n': pmKey = PROJECTM_K_RETURN; break; #ifdef HAVE_PROJECTM_TEXT_FUNCTIONS @@ -305,6 +371,12 @@ bool DistrhoUIProM::onMouse(const MouseEvent& ev) return false; } +void DistrhoUIProM::onResize(const ResizeEvent& ev) +{ + fResized = true; + UI::onResize(ev); +} + // ----------------------------------------------------------------------- UI* createUI() diff --git a/plugins/ProM/DistrhoUIProM.hpp b/plugins/ProM/DistrhoUIProM.hpp index 13fb8a1..a583fdb 100644 --- a/plugins/ProM/DistrhoUIProM.hpp +++ b/plugins/ProM/DistrhoUIProM.hpp @@ -42,7 +42,6 @@ protected: // UI Callbacks void uiIdle() override; - void uiReshape(uint width, uint height) override; // ------------------------------------------------------------------- // Widget Callbacks @@ -50,10 +49,12 @@ protected: void onDisplay() override; bool onKeyboard(const KeyboardEvent&) override; bool onMouse(const MouseEvent& ev) override; + void onResize(const ResizeEvent& ev) override; private: ScopedPointer fPM; ResizeHandle fResizeHandle; + bool fResized = true; DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(DistrhoUIProM) }; diff --git a/plugins/ProM/Makefile b/plugins/ProM/Makefile index b39f118..cb03aeb 100644 --- a/plugins/ProM/Makefile +++ b/plugins/ProM/Makefile @@ -162,6 +162,7 @@ BASE_FLAGS += -IprojectM/msvc endif # WINDOWS # silence projectM warnings +BASE_FLAGS += -Wno-deprecated-declarations BASE_FLAGS += -Wno-ignored-qualifiers BASE_FLAGS += -Wno-implicit-fallthrough BASE_FLAGS += -Wno-overflow @@ -184,13 +185,13 @@ else BASE_FLAGS += -Wno-unused-function endif # WINDOWS -# openmp (optional) -ifeq ($(DISABLE_OPENMP),) -ifneq ($(MACOS),true) -CUSTOM_BUILD_FLAGS += -D_OPENMP -fopenmp -CUSTOM_LINK_FLAGS += -fopenmp -endif # MACOS -endif # DISABLE_OPENMP +# # openmp (optional) +# ifeq ($(DISABLE_OPENMP),) +# ifneq ($(MACOS),true) +# CUSTOM_BUILD_FLAGS += -D_OPENMP -fopenmp +# CUSTOM_LINK_FLAGS += -fopenmp +# endif # MACOS +# endif # DISABLE_OPENMP # extra linker flags ifneq ($(HAIKU_OR_MACOS_OR_WINDOWS),true) @@ -200,6 +201,7 @@ ifeq ($(WINDOWS),true) LINK_FLAGS += -lpsapi endif + endif # HAVE_PROJECTM LINK_FLAGS += -lpthread diff --git a/plugins/ProM/ResizeHandle.hpp b/plugins/ProM/ResizeHandle.hpp index a307c97..6ded23d 100644 --- a/plugins/ProM/ResizeHandle.hpp +++ b/plugins/ProM/ResizeHandle.hpp @@ -153,7 +153,7 @@ private: return; hasCursor = shouldHaveCursor; - setCursor(shouldHaveCursor ? kMouseCursorDiagonal : kMouseCursorArrow); + setCursor(shouldHaveCursor ? kMouseCursorUpLeftDownRight : kMouseCursorArrow); } void resetArea() diff --git a/plugins/SoulForce/DistrhoPluginInfo.h b/plugins/SoulForce/DistrhoPluginInfo.h index aaf42cb..c888415 100644 --- a/plugins/SoulForce/DistrhoPluginInfo.h +++ b/plugins/SoulForce/DistrhoPluginInfo.h @@ -1,7 +1,7 @@ /* * DISTRHO SoulForce, a DPF'ied SoulForce. * Copyright (C) 2006 Niall Moody - * Copyright (C) 2015-2022 Filipe Coelho + * Copyright (C) 2015-2026 Filipe Coelho * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -25,6 +25,8 @@ #ifndef DISTRHO_PLUGIN_INFO_H_INCLUDED #define DISTRHO_PLUGIN_INFO_H_INCLUDED +#include "DistrhoArtworkSoulForce.hpp" + #define DISTRHO_PLUGIN_BRAND "DISTRHO" #define DISTRHO_PLUGIN_NAME "Soul Force" #define DISTRHO_PLUGIN_URI "http://www.niallmoody.com/ndcplugs/soulforce.htm" @@ -36,6 +38,9 @@ #define DISTRHO_PLUGIN_NUM_OUTPUTS 2 #define DISTRHO_PLUGIN_WANT_PROGRAMS 1 +#define DISTRHO_UI_DEFAULT_WIDTH DistrhoArtworkSoulForce::backgroundWidth +#define DISTRHO_UI_DEFAULT_HEIGHT DistrhoArtworkSoulForce::backgroundHeight + #define DISTRHO_PLUGIN_CLAP_FEATURES "audio-effect", "distortion", "stereo" #define DISTRHO_PLUGIN_LV2_CATEGORY "lv2:WaveshaperPlugin" #define DISTRHO_PLUGIN_VST3_CATEGORIES "Fx|Distortion|Stereo" diff --git a/plugins/SoulForce/DistrhoUISoulForce.cpp b/plugins/SoulForce/DistrhoUISoulForce.cpp index 5c3ccb7..1d489bc 100644 --- a/plugins/SoulForce/DistrhoUISoulForce.cpp +++ b/plugins/SoulForce/DistrhoUISoulForce.cpp @@ -1,7 +1,7 @@ /* * DISTRHO SoulForce, a DPF'ied SoulForce. * Copyright (C) 2006 Niall Moody - * Copyright (C) 2015-2021 Filipe Coelho + * Copyright (C) 2015-2026 Filipe Coelho * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -32,7 +32,7 @@ namespace Art = DistrhoArtworkSoulForce; // ----------------------------------------------------------------------- DistrhoUISoulForce::DistrhoUISoulForce() - : UI(Art::backgroundWidth, Art::backgroundHeight, true), + : UI(Art::backgroundWidth, Art::backgroundHeight, kInternalScalingMatchingHost), fImgBackground(Art::backgroundData, Art::backgroundWidth, Art::backgroundHeight, kImageFormatBGR), fImgLedOff(Art::led_offData, Art::led_offWidth, Art::led_offHeight, kImageFormatBGR), fImgLedOn(Art::led_onData, Art::led_onWidth, Art::led_onHeight, kImageFormatBGR), diff --git a/plugins/SoulForce/DistrhoUISoulForce.hpp b/plugins/SoulForce/DistrhoUISoulForce.hpp index 951a5c3..53f186a 100644 --- a/plugins/SoulForce/DistrhoUISoulForce.hpp +++ b/plugins/SoulForce/DistrhoUISoulForce.hpp @@ -1,7 +1,7 @@ /* * DISTRHO SoulForce, a DPF'ied SoulForce. * Copyright (C) 2006 Niall Moody - * Copyright (C) 2015 Filipe Coelho + * Copyright (C) 2015-2026 Filipe Coelho * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -28,8 +28,6 @@ #include "DistrhoUI.hpp" #include "ImageWidgets.hpp" -#include "DistrhoArtworkSoulForce.hpp" - START_NAMESPACE_DISTRHO // ----------------------------------------------------------------------- diff --git a/plugins/common/gen_dsp/genlib_ops.h b/plugins/common/gen_dsp/genlib_ops.h index 810054d..213016a 100644 --- a/plugins/common/gen_dsp/genlib_ops.h +++ b/plugins/common/gen_dsp/genlib_ops.h @@ -682,9 +682,11 @@ struct Noise { inline t_sample operator()() { last = 1664525L * last + 1013904223L; - unsigned long itemp = 0x3f800000 | (0x007fffff & last); - unsigned long* itempptr = &itemp; - return ((*(float *)itempptr) * 2.f) - 3.f; + union { + unsigned long ul; + float f; + } itemp = { 0x3f800000 | (0x007fffff & last) }; + return itemp.f * 2.f - 3.f; } }; diff --git a/plugins/glBars/DistrhoPluginInfo.h b/plugins/glBars/DistrhoPluginInfo.h index 2bd321e..7cd4aeb 100644 --- a/plugins/glBars/DistrhoPluginInfo.h +++ b/plugins/glBars/DistrhoPluginInfo.h @@ -3,7 +3,7 @@ * Copyright (C) 1998-2000 Peter Alm, Mikael Alm, Olle Hallnas, Thomas Nilsson and 4Front Technologies * Copyright (C) 2000 Christian Zander * Copyright (C) 2015 Nedko Arnaudov - * Copyright (C) 2016-2022 Filipe Coelho + * Copyright (C) 2016-2026 Filipe Coelho * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -35,6 +35,9 @@ #define DISTRHO_PLUGIN_VST3_CATEGORIES "Fx|Analyzer" #define DISTRHO_UI_USER_RESIZABLE 1 +#define DISTRHO_UI_DEFAULT_WIDTH 512 +#define DISTRHO_UI_DEFAULT_HEIGHT 512 + enum Parameters { kParameterScale = 0, kParameterSpeed, diff --git a/plugins/glBars/DistrhoUIGLBars.cpp b/plugins/glBars/DistrhoUIGLBars.cpp index ef1deea..ebc592d 100644 --- a/plugins/glBars/DistrhoUIGLBars.cpp +++ b/plugins/glBars/DistrhoUIGLBars.cpp @@ -3,7 +3,7 @@ * Copyright (C) 1998-2000 Peter Alm, Mikael Alm, Olle Hallnas, Thomas Nilsson and 4Front Technologies * Copyright (C) 2000 Christian Zander * Copyright (C) 2015 Nedko Arnaudov - * Copyright (C) 2016-2022 Filipe Coelho + * Copyright (C) 2016-2026 Filipe Coelho * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -23,19 +23,17 @@ START_NAMESPACE_DISTRHO -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------------------------------------------------------- DistrhoUIGLBars::DistrhoUIGLBars() - : UI(512, 512), + : UI(), fInitialized(false), - fResizeHandle(this) + fResizeHandle(this), + fPluginPtr(static_cast(getPluginInstancePointer())) { const double scaleFactor = getScaleFactor(); - if (d_isNotZero(scaleFactor)) - setSize(512*scaleFactor, 512*scaleFactor); - - setGeometryConstraints(256*scaleFactor, 256*scaleFactor, true); + setGeometryConstraints(256 * scaleFactor, 256 * scaleFactor, true); // no need to show resize handle if window is user-resizable if (isResizable()) @@ -44,17 +42,14 @@ DistrhoUIGLBars::DistrhoUIGLBars() DistrhoUIGLBars::~DistrhoUIGLBars() { - if (! fInitialized) - return; - - if (DistrhoPluginGLBars* const dspPtr = (DistrhoPluginGLBars*)getPluginInstancePointer()) + if (fInitialized && fPluginPtr != nullptr) { - const MutexLocker csm(dspPtr->fMutex); - dspPtr->fState = nullptr; + const MutexLocker csm(fPluginPtr->fMutex); + fPluginPtr->fState = nullptr; } } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------------------------------------------------------- // DSP Callbacks void DistrhoUIGLBars::parameterChanged(uint32_t index, float value) @@ -83,26 +78,26 @@ void DistrhoUIGLBars::parameterChanged(uint32_t index, float value) } } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------------------------------------------------------- // UI Callbacks void DistrhoUIGLBars::uiIdle() { repaint(); - if (DistrhoPluginGLBars* const dspPtr = (DistrhoPluginGLBars*)getPluginInstancePointer()) + if (fPluginPtr != nullptr) { - if (dspPtr->fState != nullptr) + if (fPluginPtr->fState != nullptr) return; fInitialized = true; - const MutexLocker csm(dspPtr->fMutex); - dspPtr->fState = &fState; + const MutexLocker csm(fPluginPtr->fMutex); + fPluginPtr->fState = &fState; } } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------------------------------------------------------- // Widget Callbacks void DistrhoUIGLBars::onDisplay() @@ -110,13 +105,13 @@ void DistrhoUIGLBars::onDisplay() fState.Render(); } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------------------------------------------------------- UI* createUI() { return new DistrhoUIGLBars(); } -// ----------------------------------------------------------------------- +// -------------------------------------------------------------------------------------------------------------------- END_NAMESPACE_DISTRHO diff --git a/plugins/glBars/DistrhoUIGLBars.hpp b/plugins/glBars/DistrhoUIGLBars.hpp index e1cf991..4fc24a0 100644 --- a/plugins/glBars/DistrhoUIGLBars.hpp +++ b/plugins/glBars/DistrhoUIGLBars.hpp @@ -3,7 +3,7 @@ * Copyright (C) 1998-2000 Peter Alm, Mikael Alm, Olle Hallnas, Thomas Nilsson and 4Front Technologies * Copyright (C) 2000 Christian Zander * Copyright (C) 2015 Nedko Arnaudov - * Copyright (C) 2016-2022 Filipe Coelho + * Copyright (C) 2016-2026 Filipe Coelho * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -28,6 +28,8 @@ START_NAMESPACE_DISTRHO +class DistrhoPluginGLBars; + // ----------------------------------------------------------------------- class DistrhoUIGLBars : public UI @@ -56,6 +58,7 @@ private: bool fInitialized; glBarsState fState; ResizeHandle fResizeHandle; + DistrhoPluginGLBars* const fPluginPtr; DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(DistrhoUIGLBars) }; diff --git a/plugins/glBars/ResizeHandle.hpp b/plugins/glBars/ResizeHandle.hpp index 3e94963..c408e3d 100644 --- a/plugins/glBars/ResizeHandle.hpp +++ b/plugins/glBars/ResizeHandle.hpp @@ -167,7 +167,7 @@ private: return; hasCursor = shouldHaveCursor; - setCursor(shouldHaveCursor ? kMouseCursorDiagonal : kMouseCursorArrow); + setCursor(shouldHaveCursor ? kMouseCursorUpLeftDownRight : kMouseCursorArrow); } void resetArea()