diff --git a/source/backend/Makefile b/source/backend/Makefile index fd7f1b2d2..c2f97c6c0 100644 --- a/source/backend/Makefile +++ b/source/backend/Makefile @@ -30,6 +30,10 @@ STANDALONE_LIBS += $(MODULEDIR)/lilv.a STANDALONE_LIBS += $(MODULEDIR)/native-plugins.a STANDALONE_LIBS += $(MODULEDIR)/rtmempool.a +ifeq ($(HAVE_DGL),true) +STANDALONE_LIBS += $(MODULEDIR)/dgl.a +endif + ifeq ($(MACOS_OR_WIN32),true) STANDALONE_LIBS += $(MODULEDIR)/juce_audio_devices.a STANDALONE_LIBS += $(MODULEDIR)/juce_audio_processors.a @@ -51,6 +55,10 @@ UTILS_LIBS += $(MODULEDIR)/juce_core.a UTILS_LIBS += $(MODULEDIR)/lilv.a UTILS_LIBS += $(MODULEDIR)/native-plugins.a +ifeq ($(HAVE_DGL),true) +UTILS_LIBS += $(MODULEDIR)/dgl.a +endif + # ---------------------------------------------------------------------------------------------------------------------------- STANDALONE_LINK_FLAGS = $(JACKBRIDGE_LIBS) @@ -77,6 +85,10 @@ STANDALONE_LINK_FLAGS += $(RTAUDIO_LIBS) STANDALONE_LINK_FLAGS += $(RTMIDI_LIBS) endif +ifeq ($(HAVE_DGL),true) +STANDALONE_LINK_FLAGS += $(DGL_LIBS) +endif + ifeq ($(HAVE_FLUIDSYNTH),true) STANDALONE_LINK_FLAGS += $(FLUIDSYNTH_LIBS) endif @@ -99,6 +111,10 @@ 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 52ffdf603..f4035993e 100644 --- a/source/bridges-plugin/Makefile +++ b/source/bridges-plugin/Makefile @@ -152,6 +152,11 @@ NATIVE_LINK_FLAGS += $(JUCE_AUDIO_FORMATS_LIBS) LIBS_native += $(MODULEDIR)/native-plugins.a NATIVE_LINK_FLAGS += $(NATIVE_PLUGINS_LIBS) +ifeq ($(HAVE_DGL),true) +LIBS_native += $(MODULEDIR)/dgl.a +NATIVE_LINK_FLAGS += $(DGL_LIBS) +endif + # ---------------------------------------------------------------------------------------------------------------------------- OBJS_native = \ diff --git a/source/modules/dgl/ImageAboutWindow.hpp b/source/modules/dgl/ImageAboutWindow.hpp index 5a72ea23d..2ffc0dee6 100644 --- a/source/modules/dgl/ImageAboutWindow.hpp +++ b/source/modules/dgl/ImageAboutWindow.hpp @@ -43,7 +43,8 @@ protected: private: Image fImgBackground; - DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(ImageAboutWindow) + DISTRHO_DECLARE_NON_COPY_CLASS(ImageAboutWindow) + //DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(ImageAboutWindow) }; // ----------------------------------------------------------------------- diff --git a/source/modules/dgl/src/ImageAboutWindow.cpp b/source/modules/dgl/src/ImageAboutWindow.cpp index a12aa5783..9e90f29b4 100644 --- a/source/modules/dgl/src/ImageAboutWindow.cpp +++ b/source/modules/dgl/src/ImageAboutWindow.cpp @@ -23,8 +23,8 @@ START_NAMESPACE_DGL ImageAboutWindow::ImageAboutWindow(Window& parent, const Image& image) : Window(parent.getApp(), parent), Widget((Window&)*this), - fImgBackground(image), - leakDetector_ImageAboutWindow() + fImgBackground(image)/*, + leakDetector_ImageAboutWindow()*/ { Window::setResizable(false); Window::setSize(static_cast(image.getWidth()), static_cast(image.getHeight())); @@ -34,8 +34,8 @@ ImageAboutWindow::ImageAboutWindow(Window& parent, const Image& image) ImageAboutWindow::ImageAboutWindow(Widget* widget, const Image& image) : Window(widget->getParentApp(), widget->getParentWindow()), Widget((Window&)*this), - fImgBackground(image), - leakDetector_ImageAboutWindow() + fImgBackground(image)/*, + leakDetector_ImageAboutWindow()*/ { Window::setResizable(false); Window::setSize(static_cast(image.getWidth()), static_cast(image.getHeight())); diff --git a/source/modules/dgl/src/Window.cpp b/source/modules/dgl/src/Window.cpp index 8c05b0301..7a751e2a0 100644 --- a/source/modules/dgl/src/Window.cpp +++ b/source/modules/dgl/src/Window.cpp @@ -227,7 +227,12 @@ struct Window::PrivateData { { DBG("Destroying window..."); DBGF; - //fOnModal = false; + if (fModal.enabled) + { + exec_fini(); + close(); + } + fWidgets.clear(); if (fUsingEmbed) @@ -687,9 +692,9 @@ struct Window::PrivateData { Widget::SpecialEvent ev; ev.press = press; - ev.key = key; - ev.mod = static_cast(puglGetModifiers(fView)); - ev.time = puglGetEventTimestamp(fView); + ev.key = key; + ev.mod = static_cast(puglGetModifiers(fView)); + ev.time = puglGetEventTimestamp(fView); FOR_EACH_WIDGET_INV(rit) { @@ -704,14 +709,17 @@ struct Window::PrivateData { { DBGp("PUGL: onMouse : %i %i %i %i\n", button, press, x, y); + // FIXME - pugl sends 2 of these for each window on init, don't ask me why. we'll ignore it + if (press && button == 0 && x == 0 && y == 0) return; + if (fModal.childFocus != nullptr) return fModal.childFocus->focus(); Widget::MouseEvent ev; ev.button = button; - ev.press = press; - ev.mod = static_cast(puglGetModifiers(fView)); - ev.time = puglGetEventTimestamp(fView); + ev.press = press; + ev.mod = static_cast(puglGetModifiers(fView)); + ev.time = puglGetEventTimestamp(fView); FOR_EACH_WIDGET_INV(rit) { @@ -773,7 +781,7 @@ struct Window::PrivateData { { DBGp("PUGL: onReshape : %i %i\n", width, height); - if (width == 1 && height == 1) + if (width <= 1 && height <= 1) return; fWidth = width; @@ -794,7 +802,7 @@ struct Window::PrivateData { { DBG("PUGL: onClose\n"); - if (fModal.enabled && fModal.parent != nullptr) + if (fModal.enabled) exec_fini(); fSelf->onClose(); @@ -906,13 +914,16 @@ struct Window::PrivateData { // Window Window::Window(App& app) - : pData(new PrivateData(app, this)) {} + : pData(new PrivateData(app, this)), + leakDetector_Window() {} Window::Window(App& app, Window& parent) - : pData(new PrivateData(app, this, parent)) {} + : pData(new PrivateData(app, this, parent)), + leakDetector_Window() {} Window::Window(App& app, intptr_t parentId) - : pData(new PrivateData(app, this, parentId)) {} + : pData(new PrivateData(app, this, parentId)), + leakDetector_Window() {} Window::~Window() { diff --git a/source/modules/distrho/src/DistrhoPluginCarla.cpp b/source/modules/distrho/src/DistrhoPluginCarla.cpp index 3ba0b1147..1f0a75e42 100644 --- a/source/modules/distrho/src/DistrhoPluginCarla.cpp +++ b/source/modules/distrho/src/DistrhoPluginCarla.cpp @@ -45,22 +45,27 @@ public: fPlugin(plugin), fUI(this, 0, editParameterCallback, setParameterCallback, setStateCallback, sendNoteCallback, setSizeCallback, plugin->getInstancePointer()) { - fUI.setTitle(host->uiName); + fUI.setWindowTitle(host->uiName); if (host->uiParentId != 0) - fUI.setTransientWinId(host->uiParentId); + fUI.setWindowTransientWinId(host->uiParentId); + } + + ~UICarla() + { + fUI.quit(); } // --------------------------------------------- void carla_show(const bool yesNo) { - fUI.setVisible(yesNo); + fUI.setWindowVisible(yesNo); } - void carla_idle() + bool carla_idle() { - fUI.idle(); + return fUI.idle(); } void carla_setParameterValue(const uint32_t index, const float value) @@ -84,7 +89,7 @@ public: void carla_setUiTitle(const char* const uiTitle) { - fUI.setTitle(uiTitle); + fUI.setWindowTitle(uiTitle); } // --------------------------------------------- @@ -112,7 +117,7 @@ protected: void handleSetSize(const uint width, const uint height) { - fUI.setSize(width, height); + fUI.setWindowSize(width, height); } // --------------------------------------------- @@ -205,25 +210,23 @@ protected: static NativeParameter param; - // reset - param.hints = ::PARAMETER_IS_ENABLED; param.scalePointCount = 0; param.scalePoints = nullptr; { - int nativeParamHints = ::PARAMETER_IS_ENABLED; + int nativeParamHints = ::NATIVE_PARAMETER_IS_ENABLED; const uint32_t paramHints = fPlugin.getParameterHints(index); if (paramHints & kParameterIsAutomable) - nativeParamHints |= ::PARAMETER_IS_AUTOMABLE; + nativeParamHints |= ::NATIVE_PARAMETER_IS_AUTOMABLE; if (paramHints & kParameterIsBoolean) - nativeParamHints |= ::PARAMETER_IS_BOOLEAN; + nativeParamHints |= ::NATIVE_PARAMETER_IS_BOOLEAN; if (paramHints & kParameterIsInteger) - nativeParamHints |= ::PARAMETER_IS_INTEGER; + nativeParamHints |= ::NATIVE_PARAMETER_IS_INTEGER; if (paramHints & kParameterIsLogarithmic) - nativeParamHints |= ::PARAMETER_IS_LOGARITHMIC; + nativeParamHints |= ::NATIVE_PARAMETER_IS_LOGARITHMIC; if (paramHints & kParameterIsOutput) - nativeParamHints |= ::PARAMETER_IS_OUTPUT; + nativeParamHints |= ::NATIVE_PARAMETER_IS_OUTPUT; param.hints = static_cast(nativeParamHints); } @@ -329,7 +332,13 @@ protected: realMidiEvent.frame = midiEvent.time; realMidiEvent.size = midiEvent.size; - carla_copy(realMidiEvent.buf, midiEvent.data, midiEvent.size); + uint8_t j=0; + for (; j(inBuffer), outBuffer, frames, realMidiEvents, midiEventCount); @@ -348,17 +357,30 @@ protected: void uiShow(const bool show) override { if (show) + { createUiIfNeeded(); + CARLA_SAFE_ASSERT_RETURN(fUiPtr != nullptr,); - if (fUiPtr != nullptr) fUiPtr->carla_show(show); + } + else if (fUiPtr != nullptr) + { + delete fUiPtr; + fUiPtr = nullptr; + } } void uiIdle() override { CARLA_SAFE_ASSERT_RETURN(fUiPtr != nullptr,); - fUiPtr->carla_idle(); + if (! fUiPtr->carla_idle()) + { + uiClosed(); + + delete fUiPtr; + fUiPtr = nullptr; + } } void uiSetParameterValue(const uint32_t index, const float value) override diff --git a/source/native-plugins/Makefile b/source/native-plugins/Makefile index fb8ded749..ce467e4a8 100644 --- a/source/native-plugins/Makefile +++ b/source/native-plugins/Makefile @@ -11,7 +11,7 @@ include ../modules/Makefile.mk # ---------------------------------------------------------------------------------------------------------------------------- BUILD_C_FLAGS += -I.. -BUILD_CXX_FLAGS += -I.. -I../distrho -isystem $(CWD)/modules +BUILD_CXX_FLAGS += -I.. -isystem $(CWD)/modules -I$(CWD)/modules/distrho # ---------------------------------------------------------------------------------------------------------------------------- # Flags for _all.c @@ -62,6 +62,16 @@ OBJS += \ $(OBJDIR)/midi-file.cpp.o \ $(OBJDIR)/notes.cpp.o +# ---------------------------------------------------------------------------------------------------------------------------- +# DISTRHO plugins + +OBJS += \ + $(OBJDIR)/distrho-3bandeq.cpp.o \ + $(OBJDIR)/distrho-3bandsplitter.cpp.o \ + $(OBJDIR)/distrho-mverb.cpp.o \ + $(OBJDIR)/distrho-nekobi.cpp.o \ + $(OBJDIR)/distrho-pingpongpan.cpp.o + # ---------------------------------------------------------------------------------------------------------------------------- # ZynAddSubFX @@ -157,6 +167,33 @@ $(OBJDIR)/%.c.o: %.c # ---------------------------------------------------------------------------------------------------------------------------- +$(OBJDIR)/distrho-3bandeq.cpp.o: distrho-3bandeq.cpp + -@mkdir -p $(OBJDIR) + @echo "Compiling $<" + @$(CXX) $< $(BUILD_CXX_FLAGS) -DDISTRHO_NAMESPACE=DISTRHO_3BandEQ -Idistrho-3bandeq -I$(CWD)/modules/dgl -c -o $@ + +$(OBJDIR)/distrho-3bandsplitter.cpp.o: distrho-3bandsplitter.cpp + -@mkdir -p $(OBJDIR) + @echo "Compiling $<" + @$(CXX) $< $(BUILD_CXX_FLAGS) -DDISTRHO_NAMESPACE=DISTRHO_3BandSplitter -Idistrho-3bandsplitter -I$(CWD)/modules/dgl -c -o $@ + +$(OBJDIR)/distrho-mverb.cpp.o: distrho-mverb.cpp + -@mkdir -p $(OBJDIR) + @echo "Compiling $<" + @$(CXX) $< $(BUILD_CXX_FLAGS) -DDISTRHO_NAMESPACE=DISTRHO_MVerb -Idistrho-mverb -I$(CWD)/modules/dgl -c -o $@ + +$(OBJDIR)/distrho-nekobi.cpp.o: distrho-nekobi.cpp + -@mkdir -p $(OBJDIR) + @echo "Compiling $<" + @$(CXX) $< $(BUILD_CXX_FLAGS) -DDISTRHO_NAMESPACE=DISTRHO_Nekobi -Idistrho-nekobi -I$(CWD)/modules/dgl -c -o $@ + +$(OBJDIR)/distrho-pingpongpan.cpp.o: distrho-pingpongpan.cpp + -@mkdir -p $(OBJDIR) + @echo "Compiling $<" + @$(CXX) $< $(BUILD_CXX_FLAGS) -DDISTRHO_NAMESPACE=DISTRHO_PingPongPan -Idistrho-pingpongpan -I$(CWD)/modules/dgl -c -o $@ + +# ---------------------------------------------------------------------------------------------------------------------------- + $(OBJDIR)/zynaddsubfx-fx.cpp.o: zynaddsubfx-fx.cpp $(ZYN_UI_FILES_H) -@mkdir -p $(OBJDIR) @echo "Compiling $<" @@ -177,6 +214,8 @@ $(OBJDIR)/zynaddsubfx-ui.cpp.o: zynaddsubfx-ui.cpp $(ZYN_UI_FILES_H) $(ZYN_UI_FI @echo "Compiling $<" @$(CXX) $< $(ZYN_CXX_FLAGS) -w -c -o $@ +# ---------------------------------------------------------------------------------------------------------------------------- + $(OBJDIR)/%.cpp.o: %.cpp -@mkdir -p $(OBJDIR) @echo "Compiling $<" diff --git a/source/native-plugins/_all.c b/source/native-plugins/_all.c index 0d79df900..9ce8ebac9 100644 --- a/source/native-plugins/_all.c +++ b/source/native-plugins/_all.c @@ -36,8 +36,11 @@ extern void carla_register_native_plugin_midifile(void); extern void carla_register_native_plugin_carla(void); // DISTRHO plugins -//extern void carla_register_native_plugin_distrho_3bandeq(void); -//extern void carla_register_native_plugin_distrho_3bandsplitter(void); +extern void carla_register_native_plugin_distrho_3bandeq(void); +extern void carla_register_native_plugin_distrho_3bandsplitter(void); +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); // External-UI plugins extern void carla_register_native_plugin_bigmeter(void); @@ -71,6 +74,13 @@ void carla_register_all_plugins(void) // Carla carla_register_native_plugin_carla(); + // DISTRHO Plugins + carla_register_native_plugin_distrho_3bandeq(); + carla_register_native_plugin_distrho_3bandsplitter(); + carla_register_native_plugin_distrho_mverb(); + carla_register_native_plugin_distrho_nekobi(); + carla_register_native_plugin_distrho_pingpongpan(); + // External-UI plugins carla_register_native_plugin_bigmeter(); carla_register_native_plugin_notes(); diff --git a/source/plugin/Makefile b/source/plugin/Makefile index d00d4e475..1a6153d3b 100644 --- a/source/plugin/Makefile +++ b/source/plugin/Makefile @@ -37,6 +37,10 @@ LIBS += $(MODULEDIR)/lilv.a LIBS += $(MODULEDIR)/native-plugins.a LIBS += $(MODULEDIR)/rtmempool.a +ifeq ($(HAVE_DGL),true) +LIBS += $(MODULEDIR)/dgl.a +endif + ifeq ($(MACOS_OR_WIN32),true) LIBS += $(MODULEDIR)/juce_audio_processors.a LIBS += $(MODULEDIR)/juce_data_structures.a @@ -73,6 +77,10 @@ ifeq ($(MACOS),true) LINK_FLAGS += $(JUCE_GUI_EXTRA_LIBS) endif +ifeq ($(HAVE_DGL),true) +LINK_FLAGS += $(DGL_LIBS) +endif + ifeq ($(HAVE_FLUIDSYNTH),true) LINK_FLAGS += $(FLUIDSYNTH_LIBS) endif