DPF

DISTRHO Plugin Framework
Log | Files | Refs | Submodules | README | LICENSE

commit e412b7a1cabb1293e19cb269bf1a3bf937e03e20
parent a9dee888adbd413b82e19aa3b27e64b323a28884
Author: falkTX <falktx@falktx.com>
Date:   Thu, 12 Aug 2021 13:41:10 +0100

Cleanup

Signed-off-by: falkTX <falktx@falktx.com>

Diffstat:
M.github/workflows/makefile.yml | 11+++++++++--
Mdistrho/src/jackbridge/RtAudioBridge.hpp | 11+++++++++++
Dexamples/CairoUI/DemoWidgetClickable.cpp | 86-------------------------------------------------------------------------------
Mexamples/CairoUI/DemoWidgetClickable.hpp | 68+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----
Mexamples/CairoUI/Makefile | 1-
5 files changed, 83 insertions(+), 94 deletions(-)

diff --git a/.github/workflows/makefile.yml b/.github/workflows/makefile.yml @@ -27,14 +27,21 @@ jobs: run: | make clean >/dev/null make -j $(nproc) - - name: No namespace build + - name: As C++98 mode + env: + CFLAGS: -Werror + CXXFLAGS: -Werror -std=gnu++98 + run: | + make clean >/dev/null + make -j $(nproc) VST3_FILENAME= + - name: No namespace env: CFLAGS: -Werror CXXFLAGS: -Werror -DDONT_SET_USING_DISTRHO_NAMESPACE -DDONT_SET_USING_DGL_NAMESPACE run: | make clean >/dev/null make -j $(nproc) - - name: Custom namespace build + - name: Custom namespace env: CFLAGS: -Werror CXXFLAGS: -Werror -DDISTRHO_NAMESPACE=WubbWubb -DDGL_NAMESPACE=DabDab diff --git a/distrho/src/jackbridge/RtAudioBridge.hpp b/distrho/src/jackbridge/RtAudioBridge.hpp @@ -58,7 +58,13 @@ struct RtAudioBridge { void* jackProcessArg = nullptr; // Runtime buffers +#if DISTRHO_PLUGIN_NUM_INPUTS+DISTRHO_PLUGIN_NUM_OUTPUTS > 0 float* audioBuffers[DISTRHO_PLUGIN_NUM_INPUTS + DISTRHO_PLUGIN_NUM_OUTPUTS]; +#endif +#if DISTRHO_PLUGIN_WANT_MIDI_INPUT +#endif +#if DISTRHO_PLUGIN_WANT_MIDI_OUTPUT +#endif // TODO midi buffer, likely using ringbuffer class @@ -164,6 +170,11 @@ struct RtAudioBridge { #endif return nullptr; + +#if DISTRHO_PLUGIN_NUM_INPUTS+DISTRHO_PLUGIN_NUM_OUTPUTS > 0 + // unused + (void)portMask; +#endif } static int RtAudioCallback(void* const outputBuffer, diff --git a/examples/CairoUI/DemoWidgetClickable.cpp b/examples/CairoUI/DemoWidgetClickable.cpp @@ -1,86 +0,0 @@ -/* - * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2021 Filipe Coelho <falktx@falktx.com> - * Copyright (C) 2019-2021 Jean Pierre Cimalando <jp-dev@inbox.ru> - * - * 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. - */ - -#include "DemoWidgetClickable.hpp" - -START_NAMESPACE_DGL - -// ----------------------------------------------------------------------- - -DemoWidgetClickable::DemoWidgetClickable(SubWidget* parent) - : CairoSubWidget(parent) {} - -DemoWidgetClickable::DemoWidgetClickable(TopLevelWidget* parent) - : CairoSubWidget(parent) {} - -void DemoWidgetClickable::onCairoDisplay(const CairoGraphicsContext& context) -{ - cairo_t* cr = context.handle; - - Size<uint> sz = getSize(); - int w = sz.getWidth(); - int h = sz.getHeight(); - - switch (fColorId) - { - case 0: - cairo_set_source_rgb(cr, 0.75, 0.0, 0.0); - break; - case 1: - cairo_set_source_rgb(cr, 0.0, 0.75, 0.0); - break; - case 2: - cairo_set_source_rgb(cr, 0.0, 0.0, 0.75); - break; - } - cairo_rectangle(cr, 0, 0, w, h); - cairo_fill(cr); - - cairo_set_source_rgb(cr, 0.9, 0.9, 0.9); - cairo_new_path(cr); - cairo_move_to(cr, 0.25 * w, 0.25 * h); - cairo_line_to(cr, 0.75 * w, 0.75 * h); - cairo_stroke(cr); - cairo_new_path(cr); - cairo_move_to(cr, 0.75 * w, 0.25 * h); - cairo_line_to(cr, 0.25 * w, 0.75 * h); - cairo_stroke(cr); -} - -bool DemoWidgetClickable::onMouse(const MouseEvent& event) -{ - if (event.press) - { - int w = getWidth(); - int h = getHeight(); - int mx = event.pos.getX(); - int my = event.pos.getY(); - - bool inside = mx >= 0 && my >= 0 && mx < w && my < h; - if (inside) - { - fColorId = (fColorId + 1) % 3; - repaint(); - } - } - - return Widget::onMouse(event); -} - -// ----------------------------------------------------------------------- - -END_NAMESPACE_DGL diff --git a/examples/CairoUI/DemoWidgetClickable.hpp b/examples/CairoUI/DemoWidgetClickable.hpp @@ -26,14 +26,72 @@ START_NAMESPACE_DGL class DemoWidgetClickable : public CairoSubWidget { public: - explicit DemoWidgetClickable(SubWidget* group); - explicit DemoWidgetClickable(TopLevelWidget* parent); + explicit DemoWidgetClickable(SubWidget* const parent) + : CairoSubWidget(parent), + colorId(0) {} + + explicit DemoWidgetClickable(TopLevelWidget* const parent) + : CairoSubWidget(parent), + colorId(0) {} + protected: - void onCairoDisplay(const CairoGraphicsContext& context) override; - bool onMouse(const MouseEvent& event) override; + void onCairoDisplay(const CairoGraphicsContext& context) override + { + cairo_t* const cr = context.handle; + + const Size<uint> sz = getSize(); + const int w = sz.getWidth(); + const int h = sz.getHeight(); + + switch (colorId) + { + case 0: + cairo_set_source_rgb(cr, 0.75, 0.0, 0.0); + break; + case 1: + cairo_set_source_rgb(cr, 0.0, 0.75, 0.0); + break; + case 2: + cairo_set_source_rgb(cr, 0.0, 0.0, 0.75); + break; + } + + cairo_rectangle(cr, 0, 0, w, h); + cairo_fill(cr); + + cairo_set_source_rgb(cr, 0.9, 0.9, 0.9); + cairo_new_path(cr); + cairo_move_to(cr, 0.25 * w, 0.25 * h); + cairo_line_to(cr, 0.75 * w, 0.75 * h); + cairo_stroke(cr); + cairo_new_path(cr); + cairo_move_to(cr, 0.75 * w, 0.25 * h); + cairo_line_to(cr, 0.25 * w, 0.75 * h); + cairo_stroke(cr); + } + + bool onMouse(const MouseEvent& event) override + { + if (event.press) + { + const int w = getWidth(); + const int h = getHeight(); + const int mx = event.pos.getX(); + const int my = event.pos.getY(); + + // inside + if (mx >= 0 && my >= 0 && mx < w && my < h) + { + colorId = (colorId + 1) % 3; + repaint(); + } + } + + return Widget::onMouse(event); + } private: - unsigned fColorId = 0; + uint colorId; }; // ----------------------------------------------------------------------- diff --git a/examples/CairoUI/Makefile b/examples/CairoUI/Makefile @@ -18,7 +18,6 @@ FILES_DSP = \ FILES_UI = \ Artwork.cpp \ DemoWidgetBanner.cpp \ - DemoWidgetClickable.cpp \ CairoExampleUI.cpp # --------------------------------------------------------------