diff --git a/Makefile b/Makefile index f80f7a4..dba9119 100644 --- a/Makefile +++ b/Makefile @@ -127,6 +127,10 @@ endif cp -r modguis/MVerb.modgui/modgui $(DESTDIR)$(PREFIX)/lib/lv2/MVerb.lv2/ cp modguis/MVerb.modgui/manifest.ttl $(DESTDIR)$(PREFIX)/lib/lv2/MVerb.lv2/modgui.ttl + # Nekobi + cp -r modguis/Nekobi.modgui/modgui $(DESTDIR)$(PREFIX)/lib/lv2/Nekobi.lv2/ + cp modguis/Nekobi.modgui/manifest.ttl $(DESTDIR)$(PREFIX)/lib/lv2/Nekobi.lv2/modgui.ttl + # Max-Gen stuff # -------------------------------------------------------------- diff --git a/dpf/distrho/DistrhoUI.hpp b/dpf/distrho/DistrhoUI.hpp index 00540e8..debbff1 100644 --- a/dpf/distrho/DistrhoUI.hpp +++ b/dpf/distrho/DistrhoUI.hpp @@ -1,6 +1,6 @@ /* * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2015 Filipe Coelho + * Copyright (C) 2012-2016 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 @@ -20,7 +20,10 @@ #include "extra/LeakDetector.hpp" #include "src/DistrhoPluginChecks.h" -#if DISTRHO_UI_USE_NANOVG +#ifndef HAVE_DGL +# include "extra/ExternalWindow.hpp" +typedef DISTRHO_NAMESPACE::ExternalWindow UIWidget; +#elif DISTRHO_UI_USE_NANOVG # include "../dgl/NanoVG.hpp" typedef DGL::NanoWidget UIWidget; #else @@ -41,9 +44,8 @@ START_NAMESPACE_DISTRHO /** DPF UI class from where UI instances are created. - TODO. - - must call setSize during construction, + @note You must call setSize during construction, + @TODO Detailed information about this class. */ class UI : public UIWidget { @@ -69,25 +71,29 @@ public: double getSampleRate() const noexcept; /** - TODO: Document this. + editParameter. + @TODO Document this. */ void editParameter(uint32_t index, bool started); /** - TODO: Document this. + setParameterValue. + @TODO Document this. */ void setParameterValue(uint32_t index, float value); #if DISTRHO_PLUGIN_WANT_STATE /** - TODO: Document this. + setState. + @TODO Document this. */ void setState(const char* key, const char* value); #endif #if DISTRHO_PLUGIN_IS_SYNTH /** - TODO: Document this. + sendNote. + @TODO Document this. */ void sendNote(uint8_t channel, uint8_t note, uint8_t velocity); #endif @@ -97,11 +103,24 @@ public: * Direct DSP access - DO NOT USE THIS UNLESS STRICTLY NECESSARY!! */ /** - TODO: Document this. + getPluginInstancePointer. + @TODO Document this. */ void* getPluginInstancePointer() const noexcept; #endif +#if DISTRHO_PLUGIN_HAS_EMBED_UI && DISTRHO_PLUGIN_HAS_EXTERNAL_UI + /* -------------------------------------------------------------------------------------------------------- + * External embeddable UI helpers */ + + /** + Get the Window Id that will be used for the next created window. + @note: This function is only valid during createUI(), + it will return 0 when called from anywhere else. + */ + static uintptr_t getNextWindowId() noexcept; +#endif + protected: /* -------------------------------------------------------------------------------------------------------- * DSP/Plugin Callbacks */ @@ -137,11 +156,13 @@ protected: */ virtual void sampleRateChanged(double newSampleRate); +#ifdef HAVE_DGL /* -------------------------------------------------------------------------------------------------------- * UI Callbacks (optional) */ /** - TODO: Document this. + uiIdle. + @TODO Document this. */ virtual void uiIdle() {} @@ -167,6 +188,7 @@ protected: @see Widget::onResize(const ResizeEvent&) */ void onResize(const ResizeEvent& ev) override; +#endif // ------------------------------------------------------------------------------------------------------- @@ -176,11 +198,13 @@ private: friend class UIExporter; friend class UIExporterWindow; +#ifdef HAVE_DGL // these should not be used void setAbsoluteX(int) const noexcept {} void setAbsoluteY(int) const noexcept {} void setAbsolutePos(int, int) const noexcept {} void setAbsolutePos(const DGL::Point&) const noexcept {} +#endif DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(UI) }; @@ -196,7 +220,8 @@ private: */ /** - TODO. + createUI. + @TODO Document this. */ extern UI* createUI(); diff --git a/dpf/distrho/extra/Base64.hpp b/dpf/distrho/extra/Base64.hpp index b1cce48..da661c1 100644 --- a/dpf/distrho/extra/Base64.hpp +++ b/dpf/distrho/extra/Base64.hpp @@ -1,6 +1,6 @@ /* * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2015 Filipe Coelho + * Copyright (C) 2012-2016 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 @@ -24,7 +24,30 @@ // ----------------------------------------------------------------------- // base64 stuff, based on http://www.adp-gmbh.ch/cpp/common/base64.html -// Copyright (C) 2004-2008 René Nyffenegger + +/* + Copyright (C) 2004-2008 René Nyffenegger + + This source code is provided 'as-is', without any express or implied + warranty. In no event will the author be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this source code must not be misrepresented; you must not + claim that you wrote the original source code. If you use this source code + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original source code. + + 3. This notice may not be removed or altered from any source distribution. + + René Nyffenegger rene.nyffenegger@adp-gmbh.ch +*/ // ----------------------------------------------------------------------- // Helpers diff --git a/dpf/distrho/extra/ExternalWindow.hpp b/dpf/distrho/extra/ExternalWindow.hpp new file mode 100644 index 0000000..e3e4bcf --- /dev/null +++ b/dpf/distrho/extra/ExternalWindow.hpp @@ -0,0 +1,171 @@ +/* + * DISTRHO Plugin Framework (DPF) + * Copyright (C) 2012-2016 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_EXTERNAL_WINDOW_HPP_INCLUDED +#define DISTRHO_EXTERNAL_WINDOW_HPP_INCLUDED + +#include "String.hpp" + +#ifdef DISTRHO_OS_UNIX +# include +# include +# include +#else +# error Unsupported platform! +#endif + +START_NAMESPACE_DISTRHO + +// ----------------------------------------------------------------------- +// ExternalWindow class + +class ExternalWindow +{ +public: + ExternalWindow(const uint w = 1, const uint h = 1, const char* const t = "") + : width(w), + height(h), + title(t), + pid(0) {} + + virtual ~ExternalWindow() + { + terminateAndWaitForProcess(); + } + + uint getWidth() const noexcept + { + return width; + } + + uint getHeight() const noexcept + { + return height; + } + + const char* getTitle() const noexcept + { + return title; + } + + void setTitle(const char* const t) noexcept + { + title = t; + } + + bool isRunning() noexcept + { + if (pid <= 0) + return false; + + const pid_t p = ::waitpid(pid, nullptr, WNOHANG); + + if (p == pid || (p == -1 && errno == ECHILD)) + { + printf("NOTICE: Child process exited while idle\n"); + pid = 0; + return false; + } + + return true; + } + +protected: + bool startExternalProcess(const char* args[]) + { + terminateAndWaitForProcess(); + + pid = vfork(); + + switch (pid) + { + case 0: + execvp(args[0], (char**)args); + _exit(1); + return false; + + case -1: + printf("Could not start external ui\n"); + return false; + + default: + return true; + } + } + +private: + uint width; + uint height; + String title; + pid_t pid; + + friend class UIExporter; + + void terminateAndWaitForProcess() + { + if (pid <= 0) + return; + + printf("Waiting for previous process to stop,,,\n"); + + bool sendTerm = true; + + for (pid_t p;;) + { + p = ::waitpid(pid, nullptr, WNOHANG); + + switch (p) + { + case 0: + if (sendTerm) + { + sendTerm = false; + ::kill(pid, SIGTERM); + } + break; + + case -1: + if (errno == ECHILD) + { + printf("Done! (no such process)\n"); + pid = 0; + return; + } + break; + + default: + if (p == pid) + { + printf("Done! (clean wait)\n"); + pid = 0; + return; + } + break; + } + + // 5 msec + usleep(5*1000); + } + } + + DISTRHO_DECLARE_NON_COPY_CLASS(ExternalWindow) +}; + +// ----------------------------------------------------------------------- + +END_NAMESPACE_DISTRHO + +#endif // DISTRHO_EXTERNAL_WINDOW_HPP_INCLUDED diff --git a/dpf/distrho/src/DistrhoDefines.h b/dpf/distrho/src/DistrhoDefines.h index 83d4256..2e8f845 100644 --- a/dpf/distrho/src/DistrhoDefines.h +++ b/dpf/distrho/src/DistrhoDefines.h @@ -42,6 +42,10 @@ # endif #endif +#if defined(DISTRHO_OS_LINUX) || defined(DISTRHO_OS_MAC) +# define DISTRHO_OS_UNIX +#endif + #ifndef DISTRHO_DLL_EXTENSION # define DISTRHO_DLL_EXTENSION "so" #endif diff --git a/dpf/distrho/src/DistrhoPluginChecks.h b/dpf/distrho/src/DistrhoPluginChecks.h index 32e5ea7..608cf6b 100644 --- a/dpf/distrho/src/DistrhoPluginChecks.h +++ b/dpf/distrho/src/DistrhoPluginChecks.h @@ -45,6 +45,10 @@ # define DISTRHO_PLUGIN_HAS_UI 0 #endif +#ifndef DISTRHO_PLUGIN_HAS_EXTERNAL_UI +# define DISTRHO_PLUGIN_HAS_EXTERNAL_UI 0 +#endif + #ifndef DISTRHO_PLUGIN_IS_RT_SAFE # define DISTRHO_PLUGIN_IS_RT_SAFE 0 #endif @@ -85,6 +89,17 @@ # define DISTRHO_UI_USE_NANOVG 0 #endif +// ----------------------------------------------------------------------- +// Define DISTRHO_PLUGIN_HAS_EMBED_UI if needed + +#ifndef DISTRHO_PLUGIN_HAS_EMBED_UI +# ifdef HAVE_DGL +# define DISTRHO_PLUGIN_HAS_EMBED_UI 1 +# else +# define DISTRHO_PLUGIN_HAS_EMBED_UI 0 +# endif +#endif + // ----------------------------------------------------------------------- // Define DISTRHO_UI_URI if needed @@ -117,9 +132,9 @@ #endif // ----------------------------------------------------------------------- -// Disable UI if DGL is not available +// Disable UI if DGL or External UI is not available -#if DISTRHO_PLUGIN_HAS_UI && ! defined(HAVE_DGL) +#if DISTRHO_PLUGIN_HAS_UI && ! DISTRHO_PLUGIN_HAS_EXTERNAL_UI && ! defined(HAVE_DGL) # undef DISTRHO_PLUGIN_HAS_UI # define DISTRHO_PLUGIN_HAS_UI 0 #endif diff --git a/dpf/distrho/src/DistrhoPluginJack.cpp b/dpf/distrho/src/DistrhoPluginJack.cpp index 511053b..ff92f3b 100644 --- a/dpf/distrho/src/DistrhoPluginJack.cpp +++ b/dpf/distrho/src/DistrhoPluginJack.cpp @@ -16,7 +16,7 @@ #include "DistrhoPluginInternal.hpp" -#if DISTRHO_PLUGIN_HAS_UI && ! defined(HAVE_DGL) +#if DISTRHO_PLUGIN_HAS_UI && ! DISTRHO_PLUGIN_HAS_EMBED_UI # undef DISTRHO_PLUGIN_HAS_UI # define DISTRHO_PLUGIN_HAS_UI 0 #endif diff --git a/dpf/distrho/src/DistrhoPluginLV2export.cpp b/dpf/distrho/src/DistrhoPluginLV2export.cpp index 8950df3..d8d0fbc 100644 --- a/dpf/distrho/src/DistrhoPluginLV2export.cpp +++ b/dpf/distrho/src/DistrhoPluginLV2export.cpp @@ -49,12 +49,7 @@ # define DISTRHO_PLUGIN_USES_MODGUI 0 #endif -#if DISTRHO_PLUGIN_HAS_UI && ! defined(HAVE_DGL) -# undef DISTRHO_PLUGIN_HAS_UI -# define DISTRHO_PLUGIN_HAS_UI 0 -#endif - -#if DISTRHO_PLUGIN_HAS_UI +#if DISTRHO_PLUGIN_HAS_EMBED_UI # if DISTRHO_OS_HAIKU # define DISTRHO_LV2_UI_TYPE "BeUI" # elif DISTRHO_OS_MAC @@ -64,6 +59,8 @@ # else # define DISTRHO_LV2_UI_TYPE "X11UI" # endif +#else +# define DISTRHO_LV2_UI_TYPE "UI" #endif #define DISTRHO_LV2_USE_EVENTS_IN (DISTRHO_PLUGIN_WANT_MIDI_INPUT || DISTRHO_PLUGIN_WANT_TIMEPOS || (DISTRHO_PLUGIN_WANT_STATE && DISTRHO_PLUGIN_HAS_UI)) @@ -137,10 +134,12 @@ void lv2_generate_ttl(const char* const basename) manifestString += " ui:showInterface ;\n"; # endif manifestString += "\n"; +# if DISTRHO_PLUGIN_HAS_EMBED_UI manifestString += " lv2:optionalFeature ui:noUserResize ,\n"; manifestString += " ui:resize ,\n"; manifestString += " ui:touch ;\n"; manifestString += "\n"; +# endif manifestString += " lv2:requiredFeature <" LV2_DATA_ACCESS_URI "> ,\n"; manifestString += " <" LV2_INSTANCE_ACCESS_URI "> ,\n"; manifestString += " <" LV2_OPTIONS__options "> ,\n"; @@ -558,10 +557,12 @@ void lv2_generate_ttl(const char* const basename) uiString += " ui:showInterface ;\n"; # endif uiString += "\n"; +# if DISTRHO_PLUGIN_HAS_EMBED_UI uiString += " lv2:optionalFeature ui:noUserResize ,\n"; uiString += " ui:resize ,\n"; uiString += " ui:touch ;\n"; uiString += "\n"; +# endif uiString += " lv2:requiredFeature <" LV2_OPTIONS__options "> ,\n"; uiString += " <" LV2_URID__map "> .\n"; diff --git a/dpf/distrho/src/DistrhoPluginVST.cpp b/dpf/distrho/src/DistrhoPluginVST.cpp index 1016a2c..2956021 100644 --- a/dpf/distrho/src/DistrhoPluginVST.cpp +++ b/dpf/distrho/src/DistrhoPluginVST.cpp @@ -1,6 +1,6 @@ /* * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2015 Filipe Coelho + * Copyright (C) 2012-2016 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 @@ -16,7 +16,7 @@ #include "DistrhoPluginInternal.hpp" -#if DISTRHO_PLUGIN_HAS_UI && ! defined(HAVE_DGL) +#if DISTRHO_PLUGIN_HAS_UI && ! DISTRHO_PLUGIN_HAS_EMBED_UI # undef DISTRHO_PLUGIN_HAS_UI # define DISTRHO_PLUGIN_HAS_UI 0 #endif @@ -340,6 +340,10 @@ public: intptr_t vst_dispatcher(const int32_t opcode, const int32_t index, const intptr_t value, void* const ptr, const float opt) { +#if DISTRHO_PLUGIN_WANT_STATE + intptr_t ret = 0; +#endif + switch (opcode) { case effGetProgram: @@ -512,7 +516,7 @@ public: { fStateChunk = new char[1]; fStateChunk[0] = '\0'; - return 1; + ret = 1; } else { @@ -554,11 +558,11 @@ public: fStateChunk[i] = '\0'; } - return chunkSize; + ret = chunkSize; } *(void**)ptr = fStateChunk; - break; + return ret; case effSetChunk: { @@ -634,36 +638,38 @@ public: } break; -#if DISTRHO_PLUGIN_WANT_MIDI_INPUT || DISTRHO_PLUGIN_WANT_MIDI_OUTPUT || DISTRHO_PLUGIN_WANT_TIMEPOS || DISTRHO_OS_MAC case effCanDo: if (const char* const canDo = (const char*)ptr) { -# if DISTRHO_OS_MAC && DISTRHO_PLUGIN_HAS_UI +#if DISTRHO_OS_MAC && DISTRHO_PLUGIN_HAS_UI if (std::strcmp(canDo, "hasCockosViewAsConfig") == 0) { fUsingNsView = true; return 0xbeef0000; } -# endif -# if DISTRHO_PLUGIN_WANT_MIDI_INPUT - if (std::strcmp(canDo, "receiveVstEvents") == 0) - return 1; - if (std::strcmp(canDo, "receiveVstMidiEvent") == 0) - return 1; -# endif -# if DISTRHO_PLUGIN_WANT_MIDI_OUTPUT - if (std::strcmp(canDo, "sendVstEvents") == 0) +#endif + if (std::strcmp(canDo, "receiveVstEvents") == 0 || + std::strcmp(canDo, "receiveVstMidiEvent") == 0) +#if DISTRHO_PLUGIN_WANT_MIDI_INPUT return 1; - if (std::strcmp(canDo, "sendVstMidiEvent") == 0) +#else + return -1; +#endif + if (std::strcmp(canDo, "sendVstEvents") == 0 || + std::strcmp(canDo, "sendVstMidiEvent") == 0) +#if DISTRHO_PLUGIN_WANT_MIDI_OUTPUT return 1; -# endif -# if DISTRHO_PLUGIN_WANT_TIMEPOS +#else + return -1; +#endif if (std::strcmp(canDo, "receiveVstTimeInfo") == 0) +#if DISTRHO_PLUGIN_WANT_TIMEPOS return 1; -# endif +#else + return -1; +#endif } break; -#endif //case effStartProcess: //case effStopProcess: diff --git a/dpf/distrho/src/DistrhoUI.cpp b/dpf/distrho/src/DistrhoUI.cpp index a52a927..aa20967 100644 --- a/dpf/distrho/src/DistrhoUI.cpp +++ b/dpf/distrho/src/DistrhoUI.cpp @@ -1,6 +1,6 @@ /* * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2015 Filipe Coelho + * Copyright (C) 2012-2016 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 @@ -15,20 +15,27 @@ */ #include "DistrhoUIInternal.hpp" -#include "src/WidgetPrivateData.hpp" + +#ifdef HAVE_DGL +# include "src/WidgetPrivateData.hpp" +#endif START_NAMESPACE_DISTRHO /* ------------------------------------------------------------------------------------------------------------ * Static data, see DistrhoUIInternal.hpp */ -double d_lastUiSampleRate = 0.0; -void* d_lastUiDspPtr = nullptr; -Window* d_lastUiWindow = nullptr; +double d_lastUiSampleRate = 0.0; +void* d_lastUiDspPtr = nullptr; +#ifdef HAVE_DGL +Window* d_lastUiWindow = nullptr; +#endif +uintptr_t g_nextWindowId = 0; /* ------------------------------------------------------------------------------------------------------------ * UI */ +#ifdef HAVE_DGL UI::UI(uint width, uint height) : UIWidget(*d_lastUiWindow), pData(new PrivateData()) @@ -38,6 +45,11 @@ UI::UI(uint width, uint height) if (width > 0 && height > 0) setSize(width, height); } +#else +UI::UI(uint width, uint height) + : UIWidget(width, height), + pData(new PrivateData()) {} +#endif UI::~UI() { @@ -86,11 +98,22 @@ void* UI::getPluginInstancePointer() const noexcept } #endif +#if DISTRHO_PLUGIN_HAS_EMBED_UI && DISTRHO_PLUGIN_HAS_EXTERNAL_UI +/* ------------------------------------------------------------------------------------------------------------ + * External embeddable UI helpers */ + +uintptr_t UI::getNextWindowId() noexcept +{ + return g_nextWindowId; +} +#endif + /* ------------------------------------------------------------------------------------------------------------ * DSP/Plugin Callbacks (optional) */ void UI::sampleRateChanged(double) {} +#ifdef HAVE_DGL /* ------------------------------------------------------------------------------------------------------------ * UI Callbacks (optional) */ @@ -117,6 +140,7 @@ void UI::onResize(const ResizeEvent& ev) { pData->setSizeCallback(ev.size.getWidth(), ev.size.getHeight()); } +#endif // ----------------------------------------------------------------------------------------------------------- diff --git a/dpf/distrho/src/DistrhoUIInternal.hpp b/dpf/distrho/src/DistrhoUIInternal.hpp index 3872760..4034081 100644 --- a/dpf/distrho/src/DistrhoUIInternal.hpp +++ b/dpf/distrho/src/DistrhoUIInternal.hpp @@ -1,6 +1,6 @@ /* * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2015 Filipe Coelho + * Copyright (C) 2012-2016 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 @@ -18,21 +18,26 @@ #define DISTRHO_UI_INTERNAL_HPP_INCLUDED #include "../DistrhoUI.hpp" -#include "../../dgl/Application.hpp" -#include "../../dgl/Window.hpp" +#ifdef HAVE_DGL +# include "../../dgl/Application.hpp" +# include "../../dgl/Window.hpp" using DGL::Application; using DGL::IdleCallback; using DGL::Window; +#endif START_NAMESPACE_DISTRHO // ----------------------------------------------------------------------- // Static data, see DistrhoUI.cpp -extern double d_lastUiSampleRate; -extern void* d_lastUiDspPtr; -extern Window* d_lastUiWindow; +extern double d_lastUiSampleRate; +extern void* d_lastUiDspPtr; +#ifdef HAVE_DGL +extern Window* d_lastUiWindow; +#endif +extern uintptr_t g_nextWindowId; // ----------------------------------------------------------------------- // UI callbacks @@ -128,6 +133,7 @@ struct UI::PrivateData { // ----------------------------------------------------------------------- // Plugin Window, needed to take care of resize properly +#ifdef HAVE_DGL static inline UI* createUiWrapper(void* const dspPtr, Window* const window) { @@ -191,6 +197,18 @@ private: UI* const fUI; bool fIsReady; }; +#else +static inline +UI* createUiWrapper(void* const dspPtr, const uintptr_t winId) +{ + d_lastUiDspPtr = dspPtr; + g_nextWindowId = winId; + UI* const ret = createUI(); + d_lastUiDspPtr = nullptr; + g_nextWindowId = 0; + return ret; +} +#endif // ----------------------------------------------------------------------- // UI exporter class @@ -201,10 +219,14 @@ public: UIExporter(void* const ptr, const intptr_t winId, const editParamFunc editParamCall, const setParamFunc setParamCall, const setStateFunc setStateCall, const sendNoteFunc sendNoteCall, const setSizeFunc setSizeCall, void* const dspPtr = nullptr) +#ifdef HAVE_DGL : glApp(), glWindow(glApp, winId, dspPtr), fChangingSize(false), fUI(glWindow.getUI()), +#else + : fUI(createUiWrapper(dspPtr, winId)), +#endif fData((fUI != nullptr) ? fUI->pData : nullptr) { DISTRHO_SAFE_ASSERT_RETURN(fUI != nullptr,); @@ -222,24 +244,43 @@ public: uint getWidth() const noexcept { +#ifdef HAVE_DGL return glWindow.getWidth(); +#else + DISTRHO_SAFE_ASSERT_RETURN(fUI != nullptr, 1); + return fUI->getWidth(); +#endif } uint getHeight() const noexcept { +#ifdef HAVE_DGL return glWindow.getHeight(); +#else + DISTRHO_SAFE_ASSERT_RETURN(fUI != nullptr, 1); + return fUI->getHeight(); +#endif } bool isVisible() const noexcept { +#ifdef HAVE_DGL return glWindow.isVisible(); +#else + DISTRHO_SAFE_ASSERT_RETURN(fUI != nullptr, false); + return fUI->isRunning(); +#endif } // ------------------------------------------------------------------- intptr_t getWindowId() const noexcept { +#ifdef HAVE_DGL return glWindow.getWindowId(); +#else + return 0; +#endif } // ------------------------------------------------------------------- @@ -282,6 +323,7 @@ public: // ------------------------------------------------------------------- +#ifdef HAVE_DGL void exec(IdleCallback* const cb) { DISTRHO_SAFE_ASSERT_RETURN(cb != nullptr,); @@ -297,27 +339,48 @@ public: if (glWindow.isReady()) fUI->uiIdle(); } +#endif bool idle() { DISTRHO_SAFE_ASSERT_RETURN(fUI != nullptr, false); +#ifdef HAVE_DGL glApp.idle(); if (glWindow.isReady()) fUI->uiIdle(); return ! glApp.isQuiting(); +#else + return fUI->isRunning(); +#endif } void quit() { +#ifdef HAVE_DGL glWindow.close(); glApp.quit(); +#else + DISTRHO_SAFE_ASSERT_RETURN(fUI != nullptr,); + fUI->terminateAndWaitForProcess(); +#endif } // ------------------------------------------------------------------- + void setWindowTitle(const char* const uiTitle) + { +#ifdef HAVE_DGL + glWindow.setTitle(uiTitle); +#else + DISTRHO_SAFE_ASSERT_RETURN(fUI != nullptr,); + fUI->setTitle(uiTitle); +#endif + } + +#ifdef HAVE_DGL void setWindowSize(const uint width, const uint height, const bool updateUI = false) { DISTRHO_SAFE_ASSERT_RETURN(fUI != nullptr,); @@ -333,11 +396,6 @@ public: fChangingSize = false; } - void setWindowTitle(const char* const uiTitle) - { - glWindow.setTitle(uiTitle); - } - void setWindowTransientWinId(const uintptr_t winId) { glWindow.setTransientWinId(winId); @@ -349,6 +407,11 @@ public: return ! glApp.isQuiting(); } +#else + void setWindowSize(const uint width, const uint height, const bool updateUI = false) {} + void setWindowTransientWinId(const uintptr_t winId) {} + bool setWindowVisible(const bool yesNo) { return true; } +#endif // ------------------------------------------------------------------- @@ -368,6 +431,7 @@ public: } private: +#ifdef HAVE_DGL // ------------------------------------------------------------------- // DGL Application and Window for this widget @@ -376,6 +440,7 @@ private: // prevent recursion bool fChangingSize; +#endif // ------------------------------------------------------------------- // Widget and DistrhoUI data diff --git a/modguis/Nekobi.modgui/manifest.ttl b/modguis/Nekobi.modgui/manifest.ttl new file mode 100644 index 0000000..9cec502 --- /dev/null +++ b/modguis/Nekobi.modgui/manifest.ttl @@ -0,0 +1,13 @@ +@prefix mod: . +@prefix modgui: . + + + mod:brand "DISTRHO"; + mod:label "Nekobi"; + modgui:gui [ + modgui:resourcesDirectory ; + modgui:iconTemplate ; + modgui:stylesheet ; + modgui:screenshot ; + modgui:thumbnail ; + ]. diff --git a/modguis/Nekobi.modgui/modgui/background.png b/modguis/Nekobi.modgui/modgui/background.png new file mode 100644 index 0000000..a0dd7b0 Binary files /dev/null and b/modguis/Nekobi.modgui/modgui/background.png differ diff --git a/modguis/Nekobi.modgui/modgui/footswitch.png b/modguis/Nekobi.modgui/modgui/footswitch.png new file mode 100644 index 0000000..368a234 Binary files /dev/null and b/modguis/Nekobi.modgui/modgui/footswitch.png differ diff --git a/modguis/Nekobi.modgui/modgui/icon-nekobi.html b/modguis/Nekobi.modgui/modgui/icon-nekobi.html new file mode 100644 index 0000000..fbbccd1 --- /dev/null +++ b/modguis/Nekobi.modgui/modgui/icon-nekobi.html @@ -0,0 +1,57 @@ +
+
+ +
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+ +
+ {{#effect.ports.audio.input}} +
+
+
+ {{/effect.ports.audio.input}} + {{#effect.ports.midi.input}} +
+
+
+ {{/effect.ports.midi.input}} +
+
+ {{#effect.ports.audio.output}} +
+
+
+ {{/effect.ports.audio.output}} + {{#effect.ports.midi.output}} +
+
+
+ {{/effect.ports.midi.output}} +
+
diff --git a/modguis/Nekobi.modgui/modgui/knob.png b/modguis/Nekobi.modgui/modgui/knob.png new file mode 100644 index 0000000..b6a01ab Binary files /dev/null and b/modguis/Nekobi.modgui/modgui/knob.png differ diff --git a/modguis/Nekobi.modgui/modgui/led-off.png b/modguis/Nekobi.modgui/modgui/led-off.png new file mode 100644 index 0000000..02766df Binary files /dev/null and b/modguis/Nekobi.modgui/modgui/led-off.png differ diff --git a/modguis/Nekobi.modgui/modgui/led-on.png b/modguis/Nekobi.modgui/modgui/led-on.png new file mode 100644 index 0000000..df25b6a Binary files /dev/null and b/modguis/Nekobi.modgui/modgui/led-on.png differ diff --git a/modguis/Nekobi.modgui/modgui/screenshot-nekobi.png b/modguis/Nekobi.modgui/modgui/screenshot-nekobi.png new file mode 100644 index 0000000..c61d610 Binary files /dev/null and b/modguis/Nekobi.modgui/modgui/screenshot-nekobi.png differ diff --git a/modguis/Nekobi.modgui/modgui/slider-horizontal.png b/modguis/Nekobi.modgui/modgui/slider-horizontal.png new file mode 100644 index 0000000..7c3b9da Binary files /dev/null and b/modguis/Nekobi.modgui/modgui/slider-horizontal.png differ diff --git a/modguis/Nekobi.modgui/modgui/slider-vertical.png b/modguis/Nekobi.modgui/modgui/slider-vertical.png new file mode 100644 index 0000000..959f5bc Binary files /dev/null and b/modguis/Nekobi.modgui/modgui/slider-vertical.png differ diff --git a/modguis/Nekobi.modgui/modgui/stylesheet-nekobi.css b/modguis/Nekobi.modgui/modgui/stylesheet-nekobi.css new file mode 100644 index 0000000..1108514 --- /dev/null +++ b/modguis/Nekobi.modgui/modgui/stylesheet-nekobi.css @@ -0,0 +1,278 @@ + +/* STYLES FOR THE BOXY PEDAL */ + +@import url(/fonts/nexa/stylesheet.css); +@import url(/fonts/questrial/stylesheet.css); + +/* = CONTAINER +================================================ */ +.mod-pedal-boxy{{{cns}}} { + background-position:center center; + background-repeat:no-repeat; + background-size:954px 162px; + width:954px; + height:162px; + position:absolute; + border-radius: 0px; +} + +/* = PLUGIN'S AUTHOR +================================================ */ +.mod-pedal-boxy{{{cns}}} .mod-plugin-brand { + left:0; + position:absolute; + right:0; + text-align:center; + text-transform:uppercase; + top:160px; +} + +.mod-pedal-boxy{{{cns}}} .mod-plugin-brand h1 { + border-color:#000; + border-radius:12px; + border-style:solid; + border-width:4px; + display:inline-block; + font-family:"Nexa"; + font-size:32px; + padding:3px 9px 0; +} + +/* = PLUGIN'S NAME +================================================ */ +.mod-pedal-boxy{{{cns}}} .mod-plugin-name { + left:30px; + overflow:hidden; + position:absolute; + right:30px; + text-align:center; + top:340px; +} + +.mod-pedal-boxy{{{cns}}} .mod-plugin-name h1 { + font-family:"Questrial"; + font-size:21px; + line-height:1; +} + +/* = LIGHT ON/OFF +================================================ */ +.mod-pedal-boxy{{{cns}}} .mod-light { + background-position:center center; + background-repeat:no-repeat; + height:32px; + left:10px; + position:absolute; + right:10px; + top:235px; +} + +/* = KNOBS +================================================ */ +.mod-pedal-boxy{{{cns}}} .mod-control-group { + margin:20px; + position:relative; + text-align:center; + z-index:30; +} + +.mod-pedal-boxy{{{cns}}} .mod-control-group .mod-knob { + overflow:hidden; + position:relative; +} + +.mod-pedal-boxy{{{cns}}} .mod-control-group .mod-knob { + height:110px; +} + +.mod-pedal-boxy{{{cns}}} .mod-control-group .mod-knob > span.mod-knob-title { + bottom:0px; + display:block; + font-size:11px; + font-weight:bold; + height:12px; + left:0; + line-height:1; + margin:0; + overflow:hidden; + padding:0; + position:absolute; + right:0; + text-transform:uppercase; +} + +/* = ENUMERATED LIST +================================================ */ +.mod-pedal-boxy{{{cns}}} .mod-enumerated-group { + height:31px; + margin:20px auto 0 !important; + position:relative; + width:190px; + z-index:35; +} + +.mod-pedal-boxy{{{cns}}} .mod-enumerated { + background-position:right center; + background-repeat:no-repeat; + font-size:11px; + font-weight:bold; + left:0; + line-height:2; + overflow:hidden; + position:absolute; + right:0; + text-align:left; +} + +.mod-pedal-boxy{{{cns}}} .mod-enumerated .mod-enumerated-selected { + background-color:rgba(0,0,0,.3); + box-shadow:inset 0 0 4px rgba(0,0,0,.3); + border-radius:4px; + padding:3px 9px; +} + +.mod-pedal-boxy{{{cns}}} .mod-enumerated .mod-enumerated-selected { + border-radius:4px 4px 0 0; +} + +.mod-pedal-boxy{{{cns}}} .mod-enumerated .mod-enumerated-list { + display:none; + color:#fff; +} + +.mod-pedal-boxy{{{cns}}} .mod-enumerated .mod-enumerated-list { + background-color:rgba(0,0,0,.9); + display:none; + height:115px; + overflow:auto; + position:relative; +} + +.mod-pedal-boxy{{{cns}}} .mod-enumerated .mod-enumerated-list > div { + padding:3px 9px; +} + +.mod-pedal-boxy{{{cns}}} .mod-enumerated .mod-enumerated-list > div:hover { + background-color:rgba(255,255,255,.2); + cursor:pointer; +} + +/* STYLES FOR THE PLUGIN */ + +.dpf-nekobi * { + color:black !important; +} +.dpf-nekobi { + background-image:url(/resources/background.png{{{ns}}}) !important; + background-size:954px 162px; + width:954px; + height:162px; + border-radius: 0; +} +.dpf-nekobi .mod-control-group { + width:821px; + height:65px; + top:68px; + left:67px; + margin:0px; +} +.dpf-nekobi .mod-control-group .mod-knob { + height:65px !important; +} +.dpf-nekobi .mod-control-group .mod-knob .mod-knob-image { + background-image:url(/resources/knob.png{{{ns}}}); + background-position:left center; + background-repeat:no-repeat; + background-size:auto 65px; + height:65px; + width:65px; + margin:0 auto; + cursor:pointer; + position:relative; + overflow:hidden; +} +.dpf-nekobi .mod-control-group .dpf-nekobi-knob_tuning { + left:0px; + position:absolute; +} +.dpf-nekobi .mod-control-group .dpf-nekobi-knob_cutoff { + left:215px; + position:absolute; +} +.dpf-nekobi .mod-control-group .dpf-nekobi-knob_resonance { + left:323px; + position:absolute; +} +.dpf-nekobi .mod-control-group .dpf-nekobi-knob_env_mod { + left:432px; + position:absolute; +} +.dpf-nekobi .mod-control-group .dpf-nekobi-knob_decay { + left:540px; + position:absolute; +} +.dpf-nekobi .mod-control-group .dpf-nekobi-knob_accent { + left:648px; + position:absolute; +} +.dpf-nekobi .mod-control-group .dpf-nekobi-knob_volume { + left:756px; + position:absolute; +} +.dpf-nekobi .mod-light { + background-position:top left; + background-repeat:no-repeat; + background-size:26px 27px; + height:26px; + width: 27px; + top:12px; + left:804px; +} +.dpf-nekobi .mod-light.on { + background-image:url(/resources/led-on.png{{{ns}}}); +} +.dpf-nekobi .mod-light.off { + background-image:url(/resources/led-off.png{{{ns}}}); +} +.dpf-nekobi .mod-footswitch { + background-image:url(/resources/slider-horizontal.png{{{ns}}}); + background-position:top left; + background-repeat:no-repeat; + background-size:156px 48px; + top:3px; + right:57px; + cursor:pointer; + height:48px; + width: 78px; + position:absolute; +} +.dpf-nekobi .mod-footswitch.on { + background-position:top left; +} +.dpf-nekobi .mod-footswitch.off { + background-position:top right; +} +.dpf-nekobi .dpf-nekobi-knob_waveform { + background-image:url(/resources/slider-vertical.png{{{ns}}}); + background-position:top left; + background-repeat:no-repeat; + background-size:78px 101px; + top:-17px; + left:136px; + height:101px; + cursor:pointer; + width:39px; + position:absolute; +} +.dpf-nekobi .dpf-nekobi-knob_waveform.on { + background-position:top left; +} +.dpf-nekobi .dpf-nekobi-knob_waveform.off { + background-position:top right; +} +.dpf-nekobi .mod-pedal-input , .dpf-nekobi .mod-pedal-output { + top: 60px; +} +.dpf-nekobi .mod-pedal-input .mod-input , .dpf-nekobi .mod-pedal-output .mod-output { + margin-bottom: 40px !important +} diff --git a/modguis/Nekobi.modgui/modgui/thumb-nekobi.png b/modguis/Nekobi.modgui/modgui/thumb-nekobi.png new file mode 100644 index 0000000..dc81109 Binary files /dev/null and b/modguis/Nekobi.modgui/modgui/thumb-nekobi.png differ diff --git a/modguis/PingPongPan.modgui/modgui/background.png b/modguis/PingPongPan.modgui/modgui/background.png index 6b5575e..067f247 100644 Binary files a/modguis/PingPongPan.modgui/modgui/background.png and b/modguis/PingPongPan.modgui/modgui/background.png differ diff --git a/modguis/PingPongPan.modgui/modgui/icon-ppp.html b/modguis/PingPongPan.modgui/modgui/icon-ppp.html index 121339c..09aaf73 100644 --- a/modguis/PingPongPan.modgui/modgui/icon-ppp.html +++ b/modguis/PingPongPan.modgui/modgui/icon-ppp.html @@ -1,7 +1,7 @@
-
+
diff --git a/modguis/PingPongPan.modgui/modgui/knob.png b/modguis/PingPongPan.modgui/modgui/knob.png index 5fa67e3..8b0108a 100644 Binary files a/modguis/PingPongPan.modgui/modgui/knob.png and b/modguis/PingPongPan.modgui/modgui/knob.png differ diff --git a/modguis/PingPongPan.modgui/modgui/screenshot-ppp.png b/modguis/PingPongPan.modgui/modgui/screenshot-ppp.png index a85e38b..5605446 100644 Binary files a/modguis/PingPongPan.modgui/modgui/screenshot-ppp.png and b/modguis/PingPongPan.modgui/modgui/screenshot-ppp.png differ diff --git a/modguis/PingPongPan.modgui/modgui/slider.png b/modguis/PingPongPan.modgui/modgui/slider.png new file mode 100644 index 0000000..c8e1f1d Binary files /dev/null and b/modguis/PingPongPan.modgui/modgui/slider.png differ diff --git a/modguis/PingPongPan.modgui/modgui/stylesheet-ppp.css b/modguis/PingPongPan.modgui/modgui/stylesheet-ppp.css index 8fa3896..feb0fde 100644 --- a/modguis/PingPongPan.modgui/modgui/stylesheet-ppp.css +++ b/modguis/PingPongPan.modgui/modgui/stylesheet-ppp.css @@ -9,10 +9,10 @@ .mod-pedal-boxy{{{cns}}} { background-position:center center; background-repeat:no-repeat; - background-size:230px 431px; - height:431px; + background-size:385px 212px; + width:385px; + height:212px; position:absolute; - width:230px; border-radius: 26px; } @@ -164,64 +164,61 @@ } .pingpongpan { background-image:url(/resources/background.png{{{ns}}}) !important; - background-size:615px 344px; - width:615px; - height:344px; + background-size:385px 212px; + width:385px; + height:212px; border-radius: 0; } .pingpongpan .mod-control-group { - width:500px; - height:220px; + width:237px; + height:85px; + top:71px; + left:73px; + margin:0px; } .pingpongpan .mod-control-group .mod-knob { - height:220px !important; + height:85px !important; } .pingpongpan .mod-control-group .mod-knob .mod-knob-image { background-image:url(/resources/knob.png{{{ns}}}); background-position:left center; background-repeat:no-repeat; - background-size:auto 220px; - height:220px; - width:220px; + background-size:auto 85px; + height:85px; + width:85px; margin:0 auto; cursor:pointer; position:relative; overflow:hidden; } .pingpongpan .mod-control-group .pingpongpan-knob_freq { - top:55px; - left:58px; + left:0px; position:absolute; } .pingpongpan .mod-control-group .pingpongpan-knob_width { - top:55px; - left:302px; + left:152px; position:absolute; } -.pingpongpan .mod-light { - top:32px; - left:320px; -} .pingpongpan .mod-footswitch { - background-image:url(/resources/footswitch.png{{{ns}}}); - background-position:top center; + background-image:url(/resources/slider.png{{{ns}}}); + background-position:top left; background-repeat:no-repeat; - background-size:auto 132px; - top:15px; - right:55px; + background-size:120px 37px; + top:5px; + right:37px; cursor:pointer; - height:66px; - width: 66px; + height:37px; + width: 60px; position:absolute; } .pingpongpan .mod-footswitch.on { - background-position:top center; + background-position:top left; } .pingpongpan .mod-footswitch.off { - background-position:bottom center; + background-position:top right; } .pingpongpan .mod-pedal-input , .pingpongpan .mod-pedal-output { - top: 60px; + top: 30px; } .pingpongpan .mod-pedal-input .mod-input , .pingpongpan .mod-pedal-output .mod-output { margin-bottom: 40px !important diff --git a/modguis/PingPongPan.modgui/modgui/thumb-ppp.png b/modguis/PingPongPan.modgui/modgui/thumb-ppp.png index cfca3cc..c5d511e 100644 Binary files a/modguis/PingPongPan.modgui/modgui/thumb-ppp.png and b/modguis/PingPongPan.modgui/modgui/thumb-ppp.png differ diff --git a/plugins/Nekobi/DistrhoPluginInfo.h b/plugins/Nekobi/DistrhoPluginInfo.h index 20ffdbf..9c90f7a 100644 --- a/plugins/Nekobi/DistrhoPluginInfo.h +++ b/plugins/Nekobi/DistrhoPluginInfo.h @@ -27,5 +27,6 @@ #define DISTRHO_PLUGIN_IS_SYNTH 1 #define DISTRHO_PLUGIN_NUM_INPUTS 0 #define DISTRHO_PLUGIN_NUM_OUTPUTS 1 +#define DISTRHO_PLUGIN_USES_MODGUI 1 #endif // DISTRHO_PLUGIN_INFO_H_INCLUDED