From 1b60aa757f9d0dedd904664c5b1a2eaaa5814a33 Mon Sep 17 00:00:00 2001 From: falkTX Date: Thu, 15 Jan 2015 11:34:32 +0000 Subject: [PATCH] Add distrho-prom plugin --- source/Makefile.mk | 7 + source/backend/Makefile | 8 - source/bridges-plugin/Makefile | 1 - source/native-plugins/Makefile | 18 ++ source/native-plugins/_all.c | 8 + source/native-plugins/distrho-prom.cpp | 63 ++++ .../distrho-prom/DistrhoPluginInfo.h | 38 +++ .../distrho-prom/DistrhoPluginProM.cpp | 84 +++++ .../distrho-prom/DistrhoPluginProM.hpp | 96 ++++++ .../distrho-prom/DistrhoUIProM.cpp | 305 ++++++++++++++++++ .../distrho-prom/DistrhoUIProM.hpp | 63 ++++ source/plugin/Makefile | 4 - 12 files changed, 682 insertions(+), 13 deletions(-) create mode 100644 source/native-plugins/distrho-prom.cpp create mode 100644 source/native-plugins/distrho-prom/DistrhoPluginInfo.h create mode 100644 source/native-plugins/distrho-prom/DistrhoPluginProM.cpp create mode 100644 source/native-plugins/distrho-prom/DistrhoPluginProM.hpp create mode 100644 source/native-plugins/distrho-prom/DistrhoUIProM.cpp create mode 100644 source/native-plugins/distrho-prom/DistrhoUIProM.hpp diff --git a/source/Makefile.mk b/source/Makefile.mk index a95fe8faf..b77b8af85 100644 --- a/source/Makefile.mk +++ b/source/Makefile.mk @@ -376,6 +376,13 @@ endif # -------------------------------------------------------------- # Set libs stuff (part 3) +ifeq ($(HAVE_DGL),true) +NATIVE_PLUGINS_LIBS += $(DGL_LIBS) +ifeq ($(HAVE_PROJECTM),true) +NATIVE_PLUGINS_LIBS += $(PROJECTM_LIBS) +endif +endif + ifeq ($(HAVE_ZYN_DEPS),true) NATIVE_PLUGINS_FLAGS += -DHAVE_ZYN_DEPS NATIVE_PLUGINS_LIBS += $(shell pkg-config --libs fftw3 mxml zlib) diff --git a/source/backend/Makefile b/source/backend/Makefile index 11463aefa..9424a028c 100644 --- a/source/backend/Makefile +++ b/source/backend/Makefile @@ -100,10 +100,6 @@ ifeq ($(HAVE_LINUXSAMPLER),true) STANDALONE_LINK_FLAGS += $(LINUXSAMPLER_LIBS) endif -ifeq ($(HAVE_DGL),true) -STANDALONE_LINK_FLAGS += $(DGL_LIBS) -endif - ifeq ($(HAVE_X11),true) STANDALONE_LINK_FLAGS += $(X11_LIBS) endif @@ -114,10 +110,6 @@ UTILS_LINK_FLAGS += $(JUCE_CORE_LIBS) UTILS_LINK_FLAGS += $(LILV_LIBS) UTILS_LINK_FLAGS += $(NATIVE_PLUGINS_LIBS) -ifeq ($(HAVE_DGL),true) -UTILS_LINK_FLAGS += $(DGL_LIBS) -endif - ifneq ($(HAIKU),true) UTILS_LINK_FLAGS += -lpthread endif diff --git a/source/bridges-plugin/Makefile b/source/bridges-plugin/Makefile index f4035993e..23906113c 100644 --- a/source/bridges-plugin/Makefile +++ b/source/bridges-plugin/Makefile @@ -154,7 +154,6 @@ NATIVE_LINK_FLAGS += $(NATIVE_PLUGINS_LIBS) ifeq ($(HAVE_DGL),true) LIBS_native += $(MODULEDIR)/dgl.a -NATIVE_LINK_FLAGS += $(DGL_LIBS) endif # ---------------------------------------------------------------------------------------------------------------------------- diff --git a/source/native-plugins/Makefile b/source/native-plugins/Makefile index dccf87be3..6e1fa32f9 100644 --- a/source/native-plugins/Makefile +++ b/source/native-plugins/Makefile @@ -18,6 +18,13 @@ BUILD_CXX_FLAGS += -I.. -isystem $(CWD)/modules -I$(CWD)/modules/distrho ALL_C_FLAGS = $(BUILD_C_FLAGS) +# DISTRHO ProM +ifeq ($(HAVE_DGL),true) +ifeq ($(HAVE_PROJECTM),true) +ALL_C_FLAGS += -DWANT_DISTRHO_PROM +endif +endif + # ZynAddSubFX ifeq ($(HAVE_ZYN_DEPS),true) ALL_C_FLAGS += -DWANT_ZYNADDSUBFX @@ -77,6 +84,12 @@ OBJS += \ $(OBJDIR)/distrho-nekobi.cpp.o \ $(OBJDIR)/distrho-pingpongpan.cpp.o +ifeq ($(HAVE_DGL),true) +ifeq ($(HAVE_PROJECTM),true) +OBJS += $(OBJDIR)/distrho-prom.cpp.o +endif +endif + # ---------------------------------------------------------------------------------------------------------------------------- # ZynAddSubFX @@ -207,6 +220,11 @@ $(OBJDIR)/distrho-pingpongpan.cpp.o: distrho-pingpongpan.cpp @echo "Compiling $<" @$(CXX) $< $(BUILD_CXX_FLAGS) -DDISTRHO_NAMESPACE=DISTRHO_PingPongPan -Idistrho-pingpongpan -I$(CWD)/modules/dgl -Wno-effc++ -c -o $@ +$(OBJDIR)/distrho-prom.cpp.o: distrho-prom.cpp + -@mkdir -p $(OBJDIR) + @echo "Compiling $<" + @$(CXX) $< $(BUILD_CXX_FLAGS) -DDISTRHO_NAMESPACE=DISTRHO_ProM -Idistrho-prom -I$(CWD)/modules/dgl -Wno-effc++ -c -o $@ + # ---------------------------------------------------------------------------------------------------------------------------- $(OBJDIR)/zynaddsubfx-fx.cpp.o: zynaddsubfx-fx.cpp $(ZYN_UI_FILES_H) diff --git a/source/native-plugins/_all.c b/source/native-plugins/_all.c index bd7c92c30..dcfe1e24b 100644 --- a/source/native-plugins/_all.c +++ b/source/native-plugins/_all.c @@ -44,6 +44,10 @@ extern void carla_register_native_plugin_distrho_mverb(void); extern void carla_register_native_plugin_distrho_nekobi(void); extern void carla_register_native_plugin_distrho_pingpongpan(void); +#ifdef WANT_DISTRHO_PROM +extern void carla_register_native_plugin_distrho_prom(void); +#endif + // External-UI plugins extern void carla_register_native_plugin_bigmeter(void); extern void carla_register_native_plugin_notes(void); @@ -90,6 +94,10 @@ void carla_register_all_plugins(void) carla_register_native_plugin_distrho_nekobi(); carla_register_native_plugin_distrho_pingpongpan(); +#ifdef WANT_DISTRHO_PROM + carla_register_native_plugin_distrho_prom(); +#endif + // External-UI plugins carla_register_native_plugin_bigmeter(); carla_register_native_plugin_notes(); diff --git a/source/native-plugins/distrho-prom.cpp b/source/native-plugins/distrho-prom.cpp new file mode 100644 index 000000000..a74a0b958 --- /dev/null +++ b/source/native-plugins/distrho-prom.cpp @@ -0,0 +1,63 @@ +/* + * Carla Native Plugins + * Copyright (C) 2012-2015 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 + * published by the Free Software Foundation; either version 2 of + * the License, or any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * For a full copy of the GNU General Public License see the doc/GPL.txt file. + */ + + +// Plugin Code +#include "distrho-prom/DistrhoPluginProM.cpp" +#include "distrho-prom/DistrhoUIProM.cpp" + +// DISTRHO Code +#define DISTRHO_PLUGIN_TARGET_CARLA +#include "DistrhoPluginMain.cpp" +#include "DistrhoUIMain.cpp" + +START_NAMESPACE_DISTRHO + +// ----------------------------------------------------------------------- + +static const NativePluginDescriptor promDesc = { + /* category */ NATIVE_PLUGIN_CATEGORY_UTILITY, + /* hints */ static_cast(NATIVE_PLUGIN_IS_RTSAFE|NATIVE_PLUGIN_HAS_UI|NATIVE_PLUGIN_NEEDS_UI_MAIN_THREAD|NATIVE_PLUGIN_USES_PARENT_ID), + /* supports */ static_cast(0x0), + /* audioIns */ DISTRHO_PLUGIN_NUM_INPUTS, + /* audioOuts */ DISTRHO_PLUGIN_NUM_OUTPUTS, + /* midiIns */ 0, + /* midiOuts */ 0, + /* paramIns */ 0, + /* paramOuts */ 0, + /* name */ DISTRHO_PLUGIN_NAME, + /* label */ "prom", + /* maker */ "falkTX", + /* copyright */ "LGPL", + PluginDescriptorFILL(PluginCarla) +}; + +END_NAMESPACE_DISTRHO + +// ----------------------------------------------------------------------- + +CARLA_EXPORT +void carla_register_native_plugin_distrho_prom(); + +CARLA_EXPORT +void carla_register_native_plugin_distrho_prom() +{ + USE_NAMESPACE_DISTRHO + carla_register_native_plugin(&promDesc); +} + +// ----------------------------------------------------------------------- diff --git a/source/native-plugins/distrho-prom/DistrhoPluginInfo.h b/source/native-plugins/distrho-prom/DistrhoPluginInfo.h new file mode 100644 index 000000000..57cda7fb9 --- /dev/null +++ b/source/native-plugins/distrho-prom/DistrhoPluginInfo.h @@ -0,0 +1,38 @@ +/* + * DISTRHO ProM Plugin + * Copyright (C) 2014 Filipe Coelho + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * For a full copy of the license see the LICENSE file. + */ + +#ifndef DISTRHO_PLUGIN_INFO_H_INCLUDED +#define DISTRHO_PLUGIN_INFO_H_INCLUDED + +#define DISTRHO_PLUGIN_NAME "ProM" + +#define DISTRHO_PLUGIN_HAS_UI 1 +#define DISTRHO_PLUGIN_IS_SYNTH 0 + +#define DISTRHO_PLUGIN_NUM_INPUTS 1 +#define DISTRHO_PLUGIN_NUM_OUTPUTS 1 + +#define DISTRHO_PLUGIN_WANT_LATENCY 0 +#define DISTRHO_PLUGIN_WANT_PROGRAMS 0 +#define DISTRHO_PLUGIN_WANT_STATE 0 +#define DISTRHO_PLUGIN_WANT_TIMEPOS 0 + +#define DISTRHO_PLUGIN_IS_RT_SAFE 0 +#define DISTRHO_PLUGIN_WANT_DIRECT_ACCESS 1 + +#define DISTRHO_PLUGIN_URI "http://distrho.sf.net/plugins/ProM" + +#endif // DISTRHO_PLUGIN_INFO_H_INCLUDED diff --git a/source/native-plugins/distrho-prom/DistrhoPluginProM.cpp b/source/native-plugins/distrho-prom/DistrhoPluginProM.cpp new file mode 100644 index 000000000..4efad3343 --- /dev/null +++ b/source/native-plugins/distrho-prom/DistrhoPluginProM.cpp @@ -0,0 +1,84 @@ +/* + * DISTRHO ProM Plugin + * Copyright (C) 2014 Filipe Coelho + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * For a full copy of the license see the LICENSE file. + */ + +#include "DistrhoPluginProM.hpp" + +#include "libprojectM/projectM.hpp" + +START_NAMESPACE_DISTRHO + +// ----------------------------------------------------------------------- + +DistrhoPluginProM::DistrhoPluginProM() + : Plugin(0, 0, 0), + fPM(nullptr) +{ +} + +DistrhoPluginProM::~DistrhoPluginProM() +{ + DISTRHO_SAFE_ASSERT(fPM == nullptr); +} + +// ----------------------------------------------------------------------- +// Init + +void DistrhoPluginProM::d_initParameter(uint32_t, Parameter&) +{ +} + +// ----------------------------------------------------------------------- +// Internal data + +float DistrhoPluginProM::d_getParameterValue(uint32_t) const +{ + return 0.0f; +} + +void DistrhoPluginProM::d_setParameterValue(uint32_t, float) +{ +} + +// ----------------------------------------------------------------------- +// Process + +void DistrhoPluginProM::d_run(const float** inputs, float** outputs, uint32_t frames) +{ + const float* in = inputs[0]; + float* out = outputs[0]; + + if (out != in) + std::memcpy(out, in, sizeof(float)*frames); + + const MutexLocker csm(fMutex); + + if (fPM == nullptr) + return; + + if (PCM* const pcm = const_cast(fPM->pcm())) + pcm->addPCMfloat(in, frames); +} + +// ----------------------------------------------------------------------- + +Plugin* createPlugin() +{ + return new DistrhoPluginProM(); +} + +// ----------------------------------------------------------------------- + +END_NAMESPACE_DISTRHO diff --git a/source/native-plugins/distrho-prom/DistrhoPluginProM.hpp b/source/native-plugins/distrho-prom/DistrhoPluginProM.hpp new file mode 100644 index 000000000..377afcb59 --- /dev/null +++ b/source/native-plugins/distrho-prom/DistrhoPluginProM.hpp @@ -0,0 +1,96 @@ +/* + * DISTRHO ProM Plugin + * Copyright (C) 2014 Filipe Coelho + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * For a full copy of the license see the LICENSE file. + */ + +#ifndef DISTRHO_PLUGIN_3BANDEQ_HPP_INCLUDED +#define DISTRHO_PLUGIN_3BANDEQ_HPP_INCLUDED + +#include "DistrhoPlugin.hpp" + +#include "extra/d_mutex.hpp" + +class projectM; +class DistrhoUIProM; + +START_NAMESPACE_DISTRHO + +// ----------------------------------------------------------------------- + +class DistrhoPluginProM : public Plugin +{ +public: + DistrhoPluginProM(); + ~DistrhoPluginProM() override; + +protected: + // ------------------------------------------------------------------- + // Information + + const char* d_getLabel() const noexcept override + { + return "ProM"; + } + + const char* d_getMaker() const noexcept override + { + return "DISTRHO"; + } + + const char* d_getLicense() const noexcept override + { + return "LGPL"; + } + + uint32_t d_getVersion() const noexcept override + { + return 0x1000; + } + + int64_t d_getUniqueId() const noexcept override + { + return d_cconst('D', 'P', 'r', 'M'); + } + + // ------------------------------------------------------------------- + // Init + + void d_initParameter(uint32_t, Parameter&) override; + + // ------------------------------------------------------------------- + // Internal data + + float d_getParameterValue(uint32_t) const override; + void d_setParameterValue(uint32_t, float) override; + + // ------------------------------------------------------------------- + // Process + + void d_run(const float** inputs, float** outputs, uint32_t frames) override; + + // ------------------------------------------------------------------- + +private: + Mutex fMutex; + projectM* fPM; + friend class DistrhoUIProM; + + DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(DistrhoPluginProM) +}; + +// ----------------------------------------------------------------------- + +END_NAMESPACE_DISTRHO + +#endif // DISTRHO_PLUGIN_3BANDEQ_HPP_INCLUDED diff --git a/source/native-plugins/distrho-prom/DistrhoUIProM.cpp b/source/native-plugins/distrho-prom/DistrhoUIProM.cpp new file mode 100644 index 000000000..740825700 --- /dev/null +++ b/source/native-plugins/distrho-prom/DistrhoUIProM.cpp @@ -0,0 +1,305 @@ +/* + * DISTRHO ProM Plugin + * Copyright (C) 2014 Filipe Coelho + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * For a full copy of the license see the LICENSE file. + */ + +#include "DistrhoPluginProM.hpp" +#include "DistrhoUIProM.hpp" + +#include "libprojectM/projectM.hpp" + +START_NAMESPACE_DISTRHO + +// ----------------------------------------------------------------------- + +#if 0 +static const projectM::Settings kSettings = { + /* meshX */ 32, + /* meshY */ 24, + /* fps */ 35, + /* textureSize */ 1024, + /* windowWidth */ 512, + /* windowHeight */ 512, + /* presetURL */ "/usr/share/projectM/presets", + /* titleFontURL */ "/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf", + /* menuFontURL */ "/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono.ttf", + /* smoothPresetDuration */ 5, + /* presetDuration */ 30, + /* beatSensitivity */ 10.0f, + /* aspectCorrection */ true, + /* easterEgg */ 1.0f, + /* shuffleEnabled */ true, + /* softCutRatingsEnabled */ false +}; +#endif + +// ----------------------------------------------------------------------- + +DistrhoUIProM::DistrhoUIProM() + : UI() +{ + setSize(512, 512); +} + +DistrhoUIProM::~DistrhoUIProM() +{ + if (DistrhoPluginProM* const dspPtr = (DistrhoPluginProM*)d_getPluginInstancePointer()) + { + const MutexLocker csm(dspPtr->fMutex); + dspPtr->fPM = nullptr; + } +} + +// ----------------------------------------------------------------------- +// DSP Callbacks + +void DistrhoUIProM::d_parameterChanged(uint32_t, float) +{ +} + +// ----------------------------------------------------------------------- +// UI Callbacks + +void DistrhoUIProM::d_uiIdle() +{ + if (fPM == nullptr) + return; + + repaint(); + + if (DistrhoPluginProM* const dspPtr = (DistrhoPluginProM*)d_getPluginInstancePointer()) + { + if (dspPtr->fPM != nullptr) + return; + + const MutexLocker csm(dspPtr->fMutex); + dspPtr->fPM = fPM; + } +} + +void DistrhoUIProM::d_uiReshape(uint width, uint height) +{ + glEnable(GL_BLEND); + glEnable(GL_LINE_SMOOTH); + glEnable(GL_POINT_SMOOTH); + + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glShadeModel(GL_SMOOTH); + + glMatrixMode(GL_TEXTURE); + glLoadIdentity(); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(0, width, height, 0, 0.0f, 1.0f); + glViewport(0, 0, width, height); + + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + + glDrawBuffer(GL_BACK); + glReadBuffer(GL_BACK); + + glClearColor(0.0f, 0.0f, 0.0f, 0.0f); + glLineStipple(2, 0xAAAA); + + if (fPM == nullptr) + //fPM = new projectM(kSettings); + fPM = new projectM("/usr/share/projectM/config.inp"); + + fPM->projectM_resetGL(width, height); +} + +// ----------------------------------------------------------------------- +// Widget Callbacks + +void DistrhoUIProM::onDisplay() +{ + if (fPM == nullptr) + return; + + fPM->renderFrame(); +} + +bool DistrhoUIProM::onKeyboard(const KeyboardEvent& ev) +{ + if (fPM == nullptr) + return false; + + if (ev.press && (ev.key == '1' || ev.key == '+' || ev.key == '-')) + { + if (ev.key == '1') + { + if (getWidth() != 512 || getHeight() != 512) + setSize(512, 512); + } + else if (ev.key == '+') + { + /**/ if (getWidth() < 1100 && getHeight() < 1100) + setSize(getWidth()+100, getHeight()+100); + else if (getWidth() != 1100 || getHeight() != 1100) + setSize(1100, 1100); + } + else if (ev.key == '-') + { + /**/ if (getWidth() >= 200 && getHeight() >= 200) + setSize(getWidth()-100, getHeight()-100); + else if (getWidth() != 100 || getHeight() != 100) + setSize(100, 100); + } + + return true; + } + + projectMKeycode pmKey = PROJECTM_K_NONE; + projectMModifier pmMod = PROJECTM_KMOD_LSHIFT; + + if ((ev.key >= PROJECTM_K_0 && ev.key <= PROJECTM_K_9) || + (ev.key >= PROJECTM_K_A && ev.key <= PROJECTM_K_Z) || + (ev.key >= PROJECTM_K_a && ev.key <= PROJECTM_K_z)) + { + pmKey = static_cast(ev.key); + } + else + { + switch (ev.key) + { + case DGL::CHAR_BACKSPACE: + pmKey = PROJECTM_K_BACKSPACE; + break; + case DGL::CHAR_ESCAPE: + pmKey = PROJECTM_K_ESCAPE; + break; + case DGL::CHAR_DELETE: + pmKey = PROJECTM_K_DELETE; + break; + } + } + + if (pmKey == PROJECTM_K_NONE) + return false; + + if (ev.mod & DGL::MODIFIER_CTRL) + pmMod = PROJECTM_KMOD_LCTRL; + + fPM->key_handler(ev.press ? PROJECTM_KEYUP : PROJECTM_KEYDOWN, pmKey, pmMod); + + return true; +} + +bool DistrhoUIProM::onSpecial(const SpecialEvent& ev) +{ + if (fPM == nullptr) + return false; + + projectMKeycode pmKey = PROJECTM_K_NONE; + projectMModifier pmMod = PROJECTM_KMOD_LSHIFT; + + switch (ev.key) + { + case DGL::KEY_F1: + pmKey = PROJECTM_K_F1; + break; + case DGL::KEY_F2: + pmKey = PROJECTM_K_F2; + break; + case DGL::KEY_F3: + pmKey = PROJECTM_K_F3; + break; + case DGL::KEY_F4: + pmKey = PROJECTM_K_F4; + break; + case DGL::KEY_F5: + pmKey = PROJECTM_K_F5; + break; + case DGL::KEY_F6: + pmKey = PROJECTM_K_F6; + break; + case DGL::KEY_F7: + pmKey = PROJECTM_K_F7; + break; + case DGL::KEY_F8: + pmKey = PROJECTM_K_F8; + break; + case DGL::KEY_F9: + pmKey = PROJECTM_K_F9; + break; + case DGL::KEY_F10: + pmKey = PROJECTM_K_F10; + break; + case DGL::KEY_F11: + pmKey = PROJECTM_K_F11; + break; + case DGL::KEY_F12: + pmKey = PROJECTM_K_F12; + break; + case DGL::KEY_LEFT: + pmKey = PROJECTM_K_LEFT; + break; + case DGL::KEY_UP: + pmKey = PROJECTM_K_UP; + break; + case DGL::KEY_RIGHT: + pmKey = PROJECTM_K_RIGHT; + break; + case DGL::KEY_DOWN: + pmKey = PROJECTM_K_DOWN; + break; + case DGL::KEY_PAGE_UP: + pmKey = PROJECTM_K_PAGEUP; + break; + case DGL::KEY_PAGE_DOWN: + pmKey = PROJECTM_K_PAGEDOWN; + break; + case DGL::KEY_HOME: + pmKey = PROJECTM_K_HOME; + break; + case DGL::KEY_END: + pmKey = PROJECTM_K_END; + break; + case DGL::KEY_INSERT: + pmKey = PROJECTM_K_INSERT; + break; + case DGL::KEY_SHIFT: + pmKey = PROJECTM_K_LSHIFT; + break; + case DGL::KEY_CTRL: + pmKey = PROJECTM_K_LCTRL; + break; + case DGL::KEY_ALT: + case DGL::KEY_SUPER: + break; + } + + if (pmKey == PROJECTM_K_NONE) + return false; + + if (ev.mod & DGL::MODIFIER_CTRL) + pmMod = PROJECTM_KMOD_LCTRL; + + fPM->key_handler(ev.press ? PROJECTM_KEYUP : PROJECTM_KEYDOWN, pmKey, pmMod); + + return true; +} + +// ----------------------------------------------------------------------- + +UI* createUI() +{ + return new DistrhoUIProM(); +} + +// ----------------------------------------------------------------------- + +END_NAMESPACE_DISTRHO diff --git a/source/native-plugins/distrho-prom/DistrhoUIProM.hpp b/source/native-plugins/distrho-prom/DistrhoUIProM.hpp new file mode 100644 index 000000000..32a09bcc3 --- /dev/null +++ b/source/native-plugins/distrho-prom/DistrhoUIProM.hpp @@ -0,0 +1,63 @@ +/* + * DISTRHO ProM Plugin + * Copyright (C) 2014 Filipe Coelho + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * For a full copy of the license see the LICENSE file. + */ + +#ifndef DISTRHO_UI_3BANDEQ_HPP_INCLUDED +#define DISTRHO_UI_3BANDEQ_HPP_INCLUDED + +#include "DistrhoUI.hpp" + +class projectM; + +START_NAMESPACE_DISTRHO + +// ----------------------------------------------------------------------- + +class DistrhoUIProM : public UI +{ +public: + DistrhoUIProM(); + ~DistrhoUIProM() override; + +protected: + // ------------------------------------------------------------------- + // DSP Callbacks + + void d_parameterChanged(uint32_t, float) override; + + // ------------------------------------------------------------------- + // UI Callbacks + + void d_uiIdle() override; + void d_uiReshape(uint width, uint height) override; + + // ------------------------------------------------------------------- + // Widget Callbacks + + void onDisplay() override; + bool onKeyboard(const KeyboardEvent&) override; + bool onSpecial(const SpecialEvent&) override; + +private: + ScopedPointer fPM; + + DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(DistrhoUIProM) +}; + +// ----------------------------------------------------------------------- + +END_NAMESPACE_DISTRHO + +#endif // DISTRHO_UI_3BANDEQ_HPP_INCLUDED diff --git a/source/plugin/Makefile b/source/plugin/Makefile index a253f948c..4a5f35cf7 100644 --- a/source/plugin/Makefile +++ b/source/plugin/Makefile @@ -92,10 +92,6 @@ ifeq ($(HAVE_LINUXSAMPLER),true) LINK_FLAGS += $(LINUXSAMPLER_LIBS) endif -ifeq ($(HAVE_DGL),true) -LINK_FLAGS += $(DGL_LIBS) -endif - ifeq ($(HAVE_X11),true) LINK_FLAGS += $(X11_LIBS) endif