From 80608f12ccf404f819e2637630b3e217b8b6795d Mon Sep 17 00:00:00 2001 From: falkTX Date: Sun, 9 Mar 2014 16:01:25 +0000 Subject: [PATCH] Update distrho libs --- libs/dgl/App.hpp | 4 +- libs/dgl/Base.hpp | 4 +- libs/dgl/CairoWidget.hpp | 4 +- libs/dgl/Geometry.hpp | 4 +- libs/dgl/Image.hpp | 4 +- libs/dgl/ImageAboutWindow.hpp | 4 +- libs/dgl/ImageButton.hpp | 4 +- libs/dgl/ImageKnob.hpp | 4 +- libs/dgl/ImageSlider.hpp | 4 +- libs/dgl/StandaloneWindow.hpp | 4 +- libs/dgl/Widget.hpp | 4 +- libs/dgl/Window.hpp | 4 +- libs/dgl/src/App.cpp | 4 +- libs/dgl/src/Base.cpp | 4 +- libs/dgl/src/Geometry.cpp | 4 +- libs/dgl/src/Image.cpp | 4 +- libs/dgl/src/ImageAboutWindow.cpp | 4 +- libs/dgl/src/ImageButton.cpp | 4 +- libs/dgl/src/ImageKnob.cpp | 4 +- libs/dgl/src/ImageSlider.cpp | 4 +- libs/dgl/src/Widget.cpp | 4 +- libs/dgl/src/Window.cpp | 4 +- libs/distrho/DistrhoPlugin.hpp | 4 +- libs/distrho/DistrhoPluginMain.cpp | 8 +- libs/distrho/DistrhoUI.hpp | 4 +- libs/distrho/DistrhoUIMain.cpp | 8 +- libs/distrho/DistrhoUtils.hpp | 5 +- libs/distrho/src/DistrhoDefines.h | 4 +- libs/distrho/src/DistrhoPlugin.cpp | 4 +- libs/distrho/src/DistrhoPluginCarla.cpp | 471 ++++++++++++++++++ libs/distrho/src/DistrhoPluginInternal.hpp | 4 +- libs/distrho/src/DistrhoPluginLADSPA+DSSI.cpp | 4 +- libs/distrho/src/DistrhoPluginLV2.cpp | 4 +- libs/distrho/src/DistrhoPluginLV2export.cpp | 4 +- libs/distrho/src/DistrhoPluginVST.cpp | 4 +- libs/distrho/src/DistrhoUI.cpp | 4 +- libs/distrho/src/DistrhoUIDSSI.cpp | 4 +- libs/distrho/src/DistrhoUIInternal.hpp | 4 +- libs/distrho/src/DistrhoUILV2.cpp | 4 +- 39 files changed, 554 insertions(+), 78 deletions(-) create mode 100644 libs/distrho/src/DistrhoPluginCarla.cpp diff --git a/libs/dgl/App.hpp b/libs/dgl/App.hpp index 6bc817fe..c658c604 100644 --- a/libs/dgl/App.hpp +++ b/libs/dgl/App.hpp @@ -1,6 +1,6 @@ /* - * DISTRHO Plugin Toolkit (DPT) - * Copyright (C) 2012-2013 Filipe Coelho + * DISTRHO Plugin Framework (DPF) + * Copyright (C) 2012-2014 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/libs/dgl/Base.hpp b/libs/dgl/Base.hpp index d1fd807d..943d466d 100644 --- a/libs/dgl/Base.hpp +++ b/libs/dgl/Base.hpp @@ -1,6 +1,6 @@ /* - * DISTRHO Plugin Toolkit (DPT) - * Copyright (C) 2012-2013 Filipe Coelho + * DISTRHO Plugin Framework (DPF) + * Copyright (C) 2012-2014 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/libs/dgl/CairoWidget.hpp b/libs/dgl/CairoWidget.hpp index 693dc945..6de2ad3d 100644 --- a/libs/dgl/CairoWidget.hpp +++ b/libs/dgl/CairoWidget.hpp @@ -1,6 +1,6 @@ /* - * DISTRHO Plugin Toolkit (DPT) - * Copyright (C) 2012-2013 Filipe Coelho + * DISTRHO Plugin Framework (DPF) + * Copyright (C) 2012-2014 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/libs/dgl/Geometry.hpp b/libs/dgl/Geometry.hpp index 94089462..c11fd407 100644 --- a/libs/dgl/Geometry.hpp +++ b/libs/dgl/Geometry.hpp @@ -1,6 +1,6 @@ /* - * DISTRHO Plugin Toolkit (DPT) - * Copyright (C) 2012-2013 Filipe Coelho + * DISTRHO Plugin Framework (DPF) + * Copyright (C) 2012-2014 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/libs/dgl/Image.hpp b/libs/dgl/Image.hpp index dd2acd74..89d85320 100644 --- a/libs/dgl/Image.hpp +++ b/libs/dgl/Image.hpp @@ -1,6 +1,6 @@ /* - * DISTRHO Plugin Toolkit (DPT) - * Copyright (C) 2012-2013 Filipe Coelho + * DISTRHO Plugin Framework (DPF) + * Copyright (C) 2012-2014 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/libs/dgl/ImageAboutWindow.hpp b/libs/dgl/ImageAboutWindow.hpp index b46a7f11..acdaa22e 100644 --- a/libs/dgl/ImageAboutWindow.hpp +++ b/libs/dgl/ImageAboutWindow.hpp @@ -1,6 +1,6 @@ /* - * DISTRHO Plugin Toolkit (DPT) - * Copyright (C) 2012-2013 Filipe Coelho + * DISTRHO Plugin Framework (DPF) + * Copyright (C) 2012-2014 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/libs/dgl/ImageButton.hpp b/libs/dgl/ImageButton.hpp index 6180cd72..d0f474fb 100644 --- a/libs/dgl/ImageButton.hpp +++ b/libs/dgl/ImageButton.hpp @@ -1,6 +1,6 @@ /* - * DISTRHO Plugin Toolkit (DPT) - * Copyright (C) 2012-2013 Filipe Coelho + * DISTRHO Plugin Framework (DPF) + * Copyright (C) 2012-2014 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/libs/dgl/ImageKnob.hpp b/libs/dgl/ImageKnob.hpp index 395a066b..3e9ef11e 100644 --- a/libs/dgl/ImageKnob.hpp +++ b/libs/dgl/ImageKnob.hpp @@ -1,6 +1,6 @@ /* - * DISTRHO Plugin Toolkit (DPT) - * Copyright (C) 2012-2013 Filipe Coelho + * DISTRHO Plugin Framework (DPF) + * Copyright (C) 2012-2014 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/libs/dgl/ImageSlider.hpp b/libs/dgl/ImageSlider.hpp index ea2507c2..029e1da5 100644 --- a/libs/dgl/ImageSlider.hpp +++ b/libs/dgl/ImageSlider.hpp @@ -1,6 +1,6 @@ /* - * DISTRHO Plugin Toolkit (DPT) - * Copyright (C) 2012-2013 Filipe Coelho + * DISTRHO Plugin Framework (DPF) + * Copyright (C) 2012-2014 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/libs/dgl/StandaloneWindow.hpp b/libs/dgl/StandaloneWindow.hpp index a3de65ea..e3fa8400 100644 --- a/libs/dgl/StandaloneWindow.hpp +++ b/libs/dgl/StandaloneWindow.hpp @@ -1,6 +1,6 @@ /* - * DISTRHO Plugin Toolkit (DPT) - * Copyright (C) 2012-2013 Filipe Coelho + * DISTRHO Plugin Framework (DPF) + * Copyright (C) 2012-2014 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/libs/dgl/Widget.hpp b/libs/dgl/Widget.hpp index ca4caf93..ec65887f 100644 --- a/libs/dgl/Widget.hpp +++ b/libs/dgl/Widget.hpp @@ -1,6 +1,6 @@ /* - * DISTRHO Plugin Toolkit (DPT) - * Copyright (C) 2012-2013 Filipe Coelho + * DISTRHO Plugin Framework (DPF) + * Copyright (C) 2012-2014 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/libs/dgl/Window.hpp b/libs/dgl/Window.hpp index 3c2b7a1a..64d5fd3f 100644 --- a/libs/dgl/Window.hpp +++ b/libs/dgl/Window.hpp @@ -1,6 +1,6 @@ /* - * DISTRHO Plugin Toolkit (DPT) - * Copyright (C) 2012-2013 Filipe Coelho + * DISTRHO Plugin Framework (DPF) + * Copyright (C) 2012-2014 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/libs/dgl/src/App.cpp b/libs/dgl/src/App.cpp index d7568550..99d5f019 100644 --- a/libs/dgl/src/App.cpp +++ b/libs/dgl/src/App.cpp @@ -1,6 +1,6 @@ /* - * DISTRHO Plugin Toolkit (DPT) - * Copyright (C) 2012-2013 Filipe Coelho + * DISTRHO Plugin Framework (DPF) + * Copyright (C) 2012-2014 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/libs/dgl/src/Base.cpp b/libs/dgl/src/Base.cpp index 11e64e0c..58c44c4d 100644 --- a/libs/dgl/src/Base.cpp +++ b/libs/dgl/src/Base.cpp @@ -1,6 +1,6 @@ /* - * DISTRHO Plugin Toolkit (DPT) - * Copyright (C) 2012-2013 Filipe Coelho + * DISTRHO Plugin Framework (DPF) + * Copyright (C) 2012-2014 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/libs/dgl/src/Geometry.cpp b/libs/dgl/src/Geometry.cpp index 2e4d6105..e3a893d6 100644 --- a/libs/dgl/src/Geometry.cpp +++ b/libs/dgl/src/Geometry.cpp @@ -1,6 +1,6 @@ /* - * DISTRHO Plugin Toolkit (DPT) - * Copyright (C) 2012-2013 Filipe Coelho + * DISTRHO Plugin Framework (DPF) + * Copyright (C) 2012-2014 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/libs/dgl/src/Image.cpp b/libs/dgl/src/Image.cpp index 41b85a21..0fb7298a 100644 --- a/libs/dgl/src/Image.cpp +++ b/libs/dgl/src/Image.cpp @@ -1,6 +1,6 @@ /* - * DISTRHO Plugin Toolkit (DPT) - * Copyright (C) 2012-2013 Filipe Coelho + * DISTRHO Plugin Framework (DPF) + * Copyright (C) 2012-2014 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/libs/dgl/src/ImageAboutWindow.cpp b/libs/dgl/src/ImageAboutWindow.cpp index 897596ff..67b28860 100644 --- a/libs/dgl/src/ImageAboutWindow.cpp +++ b/libs/dgl/src/ImageAboutWindow.cpp @@ -1,6 +1,6 @@ /* - * DISTRHO Plugin Toolkit (DPT) - * Copyright (C) 2012-2013 Filipe Coelho + * DISTRHO Plugin Framework (DPF) + * Copyright (C) 2012-2014 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/libs/dgl/src/ImageButton.cpp b/libs/dgl/src/ImageButton.cpp index b3f67800..01ca424a 100644 --- a/libs/dgl/src/ImageButton.cpp +++ b/libs/dgl/src/ImageButton.cpp @@ -1,6 +1,6 @@ /* - * DISTRHO Plugin Toolkit (DPT) - * Copyright (C) 2012-2013 Filipe Coelho + * DISTRHO Plugin Framework (DPF) + * Copyright (C) 2012-2014 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/libs/dgl/src/ImageKnob.cpp b/libs/dgl/src/ImageKnob.cpp index 63c2f521..5e40bbdf 100644 --- a/libs/dgl/src/ImageKnob.cpp +++ b/libs/dgl/src/ImageKnob.cpp @@ -1,6 +1,6 @@ /* - * DISTRHO Plugin Toolkit (DPT) - * Copyright (C) 2012-2013 Filipe Coelho + * DISTRHO Plugin Framework (DPF) + * Copyright (C) 2012-2014 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/libs/dgl/src/ImageSlider.cpp b/libs/dgl/src/ImageSlider.cpp index f5d3362d..1c7f5b1f 100644 --- a/libs/dgl/src/ImageSlider.cpp +++ b/libs/dgl/src/ImageSlider.cpp @@ -1,6 +1,6 @@ /* - * DISTRHO Plugin Toolkit (DPT) - * Copyright (C) 2012-2013 Filipe Coelho + * DISTRHO Plugin Framework (DPF) + * Copyright (C) 2012-2014 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/libs/dgl/src/Widget.cpp b/libs/dgl/src/Widget.cpp index 54985778..0aa46f7a 100644 --- a/libs/dgl/src/Widget.cpp +++ b/libs/dgl/src/Widget.cpp @@ -1,6 +1,6 @@ /* - * DISTRHO Plugin Toolkit (DPT) - * Copyright (C) 2012-2013 Filipe Coelho + * DISTRHO Plugin Framework (DPF) + * Copyright (C) 2012-2014 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/libs/dgl/src/Window.cpp b/libs/dgl/src/Window.cpp index bc941a54..477bd3b1 100644 --- a/libs/dgl/src/Window.cpp +++ b/libs/dgl/src/Window.cpp @@ -1,6 +1,6 @@ /* - * DISTRHO Plugin Toolkit (DPT) - * Copyright (C) 2012-2013 Filipe Coelho + * DISTRHO Plugin Framework (DPF) + * Copyright (C) 2012-2014 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/libs/distrho/DistrhoPlugin.hpp b/libs/distrho/DistrhoPlugin.hpp index 9635ed6a..7cd35a34 100644 --- a/libs/distrho/DistrhoPlugin.hpp +++ b/libs/distrho/DistrhoPlugin.hpp @@ -1,6 +1,6 @@ /* - * DISTRHO Plugin Toolkit (DPT) - * Copyright (C) 2012-2013 Filipe Coelho + * DISTRHO Plugin Framework (DPF) + * Copyright (C) 2012-2014 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/libs/distrho/DistrhoPluginMain.cpp b/libs/distrho/DistrhoPluginMain.cpp index 1eb6da7a..0671344d 100644 --- a/libs/distrho/DistrhoPluginMain.cpp +++ b/libs/distrho/DistrhoPluginMain.cpp @@ -1,6 +1,6 @@ /* - * DISTRHO Plugin Toolkit (DPT) - * Copyright (C) 2012-2013 Filipe Coelho + * DISTRHO Plugin Framework (DPF) + * Copyright (C) 2012-2014 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,9 @@ #include "src/DistrhoPlugin.cpp" -#if (defined(DISTRHO_PLUGIN_TARGET_LADSPA) || defined(DISTRHO_PLUGIN_TARGET_DSSI)) +#if defined(DISTRHO_PLUGIN_TARGET_CARLA) +# include "src/DistrhoPluginCarla.cpp" +#elif (defined(DISTRHO_PLUGIN_TARGET_LADSPA) || defined(DISTRHO_PLUGIN_TARGET_DSSI)) # include "src/DistrhoPluginLADSPA+DSSI.cpp" #elif defined(DISTRHO_PLUGIN_TARGET_LV2) # include "src/DistrhoPluginLV2.cpp" diff --git a/libs/distrho/DistrhoUI.hpp b/libs/distrho/DistrhoUI.hpp index 58abaddb..180ed380 100644 --- a/libs/distrho/DistrhoUI.hpp +++ b/libs/distrho/DistrhoUI.hpp @@ -1,6 +1,6 @@ /* - * DISTRHO Plugin Toolkit (DPT) - * Copyright (C) 2012-2013 Filipe Coelho + * DISTRHO Plugin Framework (DPF) + * Copyright (C) 2012-2014 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/libs/distrho/DistrhoUIMain.cpp b/libs/distrho/DistrhoUIMain.cpp index 1eb981d5..27f219ae 100644 --- a/libs/distrho/DistrhoUIMain.cpp +++ b/libs/distrho/DistrhoUIMain.cpp @@ -1,6 +1,6 @@ /* - * DISTRHO Plugin Toolkit (DPT) - * Copyright (C) 2012-2013 Filipe Coelho + * DISTRHO Plugin Framework (DPF) + * Copyright (C) 2012-2014 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,9 @@ #include "src/DistrhoUI.cpp" -#if defined(DISTRHO_PLUGIN_TARGET_DSSI) +#if defined(DISTRHO_PLUGIN_TARGET_CARLA) +// nothing +#elif defined(DISTRHO_PLUGIN_TARGET_DSSI) # include "src/DistrhoUIDSSI.cpp" #elif defined(DISTRHO_PLUGIN_TARGET_LV2) # include "src/DistrhoUILV2.cpp" diff --git a/libs/distrho/DistrhoUtils.hpp b/libs/distrho/DistrhoUtils.hpp index 0153e5ef..3f88d045 100644 --- a/libs/distrho/DistrhoUtils.hpp +++ b/libs/distrho/DistrhoUtils.hpp @@ -1,6 +1,6 @@ /* - * DISTRHO Plugin Toolkit (DPT) - * Copyright (C) 2012-2013 Filipe Coelho + * DISTRHO Plugin Framework (DPF) + * Copyright (C) 2012-2014 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 @@ -32,6 +32,7 @@ #endif #ifdef DISTRHO_OS_WINDOWS +# include # include #else # include diff --git a/libs/distrho/src/DistrhoDefines.h b/libs/distrho/src/DistrhoDefines.h index 5f73ae88..bd72a1f3 100644 --- a/libs/distrho/src/DistrhoDefines.h +++ b/libs/distrho/src/DistrhoDefines.h @@ -1,6 +1,6 @@ /* - * DISTRHO Plugin Toolkit (DPT) - * Copyright (C) 2012-2013 Filipe Coelho + * DISTRHO Plugin Framework (DPF) + * Copyright (C) 2012-2014 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/libs/distrho/src/DistrhoPlugin.cpp b/libs/distrho/src/DistrhoPlugin.cpp index 8629ff67..7e9f382c 100644 --- a/libs/distrho/src/DistrhoPlugin.cpp +++ b/libs/distrho/src/DistrhoPlugin.cpp @@ -1,6 +1,6 @@ /* - * DISTRHO Plugin Toolkit (DPT) - * Copyright (C) 2012-2013 Filipe Coelho + * DISTRHO Plugin Framework (DPF) + * Copyright (C) 2012-2014 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/libs/distrho/src/DistrhoPluginCarla.cpp b/libs/distrho/src/DistrhoPluginCarla.cpp new file mode 100644 index 00000000..334bb876 --- /dev/null +++ b/libs/distrho/src/DistrhoPluginCarla.cpp @@ -0,0 +1,471 @@ +/* + * DISTRHO Plugin Framework (DPF) + * Copyright (C) 2012-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 LGPL.txt file + */ + +#include "DistrhoPluginInternal.hpp" + +#if DISTRHO_PLUGIN_HAS_UI +# include "DistrhoUIInternal.hpp" +#endif + +#include "CarlaNative.hpp" + +// ----------------------------------------------------------------------- + +START_NAMESPACE_DISTRHO + +#if DISTRHO_PLUGIN_HAS_UI +// ----------------------------------------------------------------------- +// Carla UI + +#if ! DISTRHO_PLUGIN_WANT_STATE +static const setStateFunc setStateCallback = nullptr; +#endif +#if ! DISTRHO_PLUGIN_IS_SYNTH +static const sendNoteFunc sendNoteCallback = nullptr; +#endif + +class UICarla +{ +public: + UICarla(const NativeHostDescriptor* const host, PluginExporter* const plugin) + : fHost(host), + fPlugin(plugin), + fUI(this, 0, editParameterCallback, setParameterCallback, setStateCallback, sendNoteCallback, uiResizeCallback) + { + fUI.setTitle(host->uiName); + } + + // --------------------------------------------- + + void carla_show(const bool yesNo) + { + fUI.setVisible(yesNo); + } + + void carla_idle() + { + fUI.idle(); + } + + void carla_setParameterValue(const uint32_t index, const float value) + { + fUI.parameterChanged(index, value); + } + +#if DISTRHO_PLUGIN_WANT_PROGRAMS + void carla_setMidiProgram(const uint32_t realProgram) + { + fUI.programChanged(realProgram); + } +#endif + +#if DISTRHO_PLUGIN_WANT_STATE + void carla_setCustomData(const char* const key, const char* const value) + { + fUI.stateChanged(key, value); + } +#endif + + void carla_setUiTitle(const char* const uiTitle) + { + fUI.setTitle(uiTitle); + } + + // --------------------------------------------- + +protected: + void handleEditParameter(const uint32_t, const bool) + { + // TODO + } + + void handleSetParameterValue(const uint32_t rindex, const float value) + { + fHost->ui_parameter_changed(fHost->handle, rindex, value); + } + + void handleSetState(const char* const key, const char* const value) + { + fHost->ui_custom_data_changed(fHost->handle, key, value); + } + + void handleSendNote(const uint8_t, const uint8_t, const uint8_t) + { + // TODO + } + + void handleUiResize(const unsigned int width, const unsigned int height) + { + fUI.setSize(width, height); + } + + // --------------------------------------------- + +private: + // Plugin stuff + const NativeHostDescriptor* const fHost; + PluginExporter* const fPlugin; + + // UI + UIExporter fUI; + + // --------------------------------------------- + // Callbacks + + #define handlePtr ((UICarla*)ptr) + + static void editParameterCallback(void* ptr, uint32_t index, bool started) + { + handlePtr->handleEditParameter(index, started); + } + + static void setParameterCallback(void* ptr, uint32_t rindex, float value) + { + handlePtr->handleSetParameterValue(rindex, value); + } + +#if DISTRHO_PLUGIN_WANT_STATE + static void setStateCallback(void* ptr, const char* key, const char* value) + { + handlePtr->handleSetState(key, value); + } +#endif + +#if DISTRHO_PLUGIN_IS_SYNTH + static void sendNoteCallback(void* ptr, uint8_t channel, uint8_t note, uint8_t velocity) + { + handlePtr->handleSendNote(channel, note, velocity); + } +#endif + + static void uiResizeCallback(void* ptr, unsigned int width, unsigned int height) + { + handlePtr->handleUiResize(width, height); + } + + #undef handlePtr + + CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(UICarla) +}; +#endif // DISTRHO_PLUGIN_HAS_UI + +// ----------------------------------------------------------------------- +// Carla Plugin + +class PluginCarla : public NativePluginClass +{ +public: + PluginCarla(const NativeHostDescriptor* const host) + : NativePluginClass(host) + { +#if DISTRHO_PLUGIN_HAS_UI + fUiPtr = nullptr; +#endif + } + + ~PluginCarla() override + { +#if DISTRHO_PLUGIN_HAS_UI + if (fUiPtr != nullptr) + { + delete fUiPtr; + fUiPtr = nullptr; + } +#endif + } + +protected: + // ------------------------------------------------------------------- + // Plugin parameter calls + + uint32_t getParameterCount() const override + { + return fPlugin.getParameterCount(); + } + + const NativeParameter* getParameterInfo(const uint32_t index) const override + { + CARLA_ASSERT(index < getParameterCount()); + + static NativeParameter param; + + // reset + param.hints = ::PARAMETER_IS_ENABLED; + param.scalePointCount = 0; + param.scalePoints = nullptr; + + { + int nativeParamHints = ::PARAMETER_IS_ENABLED; + const uint32_t paramHints = fPlugin.getParameterHints(index); + + if (paramHints & PARAMETER_IS_AUTOMABLE) + nativeParamHints |= ::PARAMETER_IS_AUTOMABLE; + if (paramHints & PARAMETER_IS_BOOLEAN) + nativeParamHints |= ::PARAMETER_IS_BOOLEAN; + if (paramHints & PARAMETER_IS_INTEGER) + nativeParamHints |= ::PARAMETER_IS_INTEGER; + if (paramHints & PARAMETER_IS_LOGARITHMIC) + nativeParamHints |= ::PARAMETER_IS_LOGARITHMIC; + if (paramHints & PARAMETER_IS_OUTPUT) + nativeParamHints |= ::PARAMETER_IS_OUTPUT; + + param.hints = static_cast(nativeParamHints); + } + + param.name = fPlugin.getParameterName(index); + param.unit = fPlugin.getParameterUnit(index); + + { + const ParameterRanges& ranges(fPlugin.getParameterRanges(index)); + + param.ranges.def = ranges.def; + param.ranges.min = ranges.min; + param.ranges.max = ranges.max; + //param.ranges.step = ranges.step; + //param.ranges.stepSmall = ranges.stepSmall; + //param.ranges.stepLarge = ranges.stepLarge; + } + + return ¶m; + } + + float getParameterValue(const uint32_t index) const override + { + CARLA_ASSERT(index < getParameterCount()); + + return fPlugin.getParameterValue(index); + } + + // ------------------------------------------------------------------- + // Plugin midi-program calls + +#if DISTRHO_PLUGIN_WANT_PROGRAMS + uint32_t getMidiProgramCount() const override + { + return fPlugin.getProgramCount(); + } + + const NativeMidiProgram* getMidiProgramInfo(const uint32_t index) const override + { + CARLA_ASSERT(index < getMidiProgramCount()); + + if (index >= fPlugin.getProgramCount()) + return nullptr; + + static NativeMidiProgram midiProgram; + + midiProgram.bank = index / 128; + midiProgram.program = index % 128; + midiProgram.name = fPlugin.getProgramName(index); + + return &midiProgram; + } +#endif + + // ------------------------------------------------------------------- + // Plugin state calls + + void setParameterValue(const uint32_t index, const float value) override + { + CARLA_ASSERT(index < getParameterCount()); + + fPlugin.setParameterValue(index, value); + } + +#if DISTRHO_PLUGIN_WANT_PROGRAMS + void setMidiProgram(const uint8_t, const uint32_t bank, const uint32_t program) override + { + const uint32_t realProgram(bank * 128 + program); + + if (realProgram >= fPlugin.getProgramCount()) + return; + + fPlugin.setProgram(realProgram); + } +#endif + +#if DISTRHO_PLUGIN_WANT_STATE + void setCustomData(const char* const key, const char* const value) override + { + CARLA_ASSERT(key != nullptr); + CARLA_ASSERT(value != nullptr); + + fPlugin.setState(key, value); + } +#endif + + // ------------------------------------------------------------------- + // Plugin process calls + + void activate() override + { + fPlugin.activate(); + } + + void deactivate() override + { + fPlugin.deactivate(); + } + +#if DISTRHO_PLUGIN_IS_SYNTH + void process(float** const inBuffer, float** const outBuffer, const uint32_t frames, const NativeMidiEvent* const midiEvents, const uint32_t midiEventCount) override + { + uint32_t i; + + for (i=0; i < midiEventCount && i < kMaxMidiEvents; ++i) + { + const NativeMidiEvent* const midiEvent(&midiEvents[i]); + MidiEvent* const realMidiEvent(&fRealMidiEvents[i]); + + realMidiEvent->frame = midiEvent->time; + realMidiEvent->size = midiEvent->size; + + for (uint8_t j=0; j < midiEvent->size; ++j) + realMidiEvent->buf[j] = midiEvent->data[j]; + } + + fPlugin.run(inBuffer, outBuffer, frames, fRealMidiEvents, i); + } +#else + void process(float** const inBuffer, float** const outBuffer, const uint32_t frames, const NativeMidiEvent* const, const uint32_t) override + { + fPlugin.run(inBuffer, outBuffer, frames); + } +#endif + + // ------------------------------------------------------------------- + // Plugin UI calls + +#if DISTRHO_PLUGIN_HAS_UI + void uiShow(const bool show) override + { + if (show) + createUiIfNeeded(); + + if (fUiPtr != nullptr) + fUiPtr->carla_show(show); + } + + void uiIdle() override + { + CARLA_ASSERT(fUiPtr != nullptr); + + if (fUiPtr != nullptr) + fUiPtr->carla_idle(); + } + + void uiSetParameterValue(const uint32_t index, const float value) override + { + CARLA_ASSERT(fUiPtr != nullptr); + CARLA_ASSERT(index < getParameterCount()); + + if (fUiPtr != nullptr) + fUiPtr->carla_setParameterValue(index, value); + } + +# if DISTRHO_PLUGIN_WANT_PROGRAMS + void uiSetMidiProgram(const uint8_t, const uint32_t bank, const uint32_t program) override + { + CARLA_ASSERT(fUiPtr != nullptr); + + const uint32_t realProgram(bank * 128 + program); + + if (realProgram >= fPlugin.getProgramCount()) + return; + + if (fUiPtr != nullptr) + fUiPtr->carla_setMidiProgram(realProgram); + } +# endif + +# if DISTRHO_PLUGIN_WANT_STATE + void uiSetCustomData(const char* const key, const char* const value) override + { + CARLA_ASSERT(fUiPtr != nullptr); + CARLA_ASSERT(key != nullptr); + CARLA_ASSERT(value != nullptr); + + if (fUiPtr != nullptr) + fUiPtr->carla_setCustomData(key, value); + } +# endif +#endif + + // ------------------------------------------------------------------- + // Plugin dispatcher calls + + void bufferSizeChanged(const uint32_t bufferSize) override + { + fPlugin.setBufferSize(bufferSize, true); + } + + void sampleRateChanged(const double sampleRate) override + { + fPlugin.setSampleRate(sampleRate, true); + } + +#if DISTRHO_PLUGIN_HAS_UI + void uiNameChanged(const char* const uiName) override + { + if (fUiPtr != nullptr) + fUiPtr->carla_setUiTitle(uiName); + } +#endif + + // ------------------------------------------------------------------- + +private: + PluginExporter fPlugin; + +#if DISTRHO_PLUGIN_IS_SYNTH + MidiEvent fRealMidiEvents[kMaxMidiEvents]; +#endif + +#if DISTRHO_PLUGIN_HAS_UI + // UI + UICarla* fUiPtr; + + void createUiIfNeeded() + { + if (fUiPtr == nullptr) + { + d_lastUiSampleRate = getSampleRate(); + fUiPtr = new UICarla(getHostHandle(), &fPlugin); + } + } +#endif + + CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(PluginCarla) + + // ------------------------------------------------------------------- + +public: + static NativePluginHandle _instantiate(const NativeHostDescriptor* host) + { + d_lastBufferSize = host->get_buffer_size(host->handle); + d_lastSampleRate = host->get_sample_rate(host->handle); + return new PluginCarla(host); + } + + static void _cleanup(NativePluginHandle handle) + { + delete (PluginCarla*)handle; + } +}; + +END_NAMESPACE_DISTRHO + +// ----------------------------------------------------------------------- diff --git a/libs/distrho/src/DistrhoPluginInternal.hpp b/libs/distrho/src/DistrhoPluginInternal.hpp index aafec70f..ad10e566 100644 --- a/libs/distrho/src/DistrhoPluginInternal.hpp +++ b/libs/distrho/src/DistrhoPluginInternal.hpp @@ -1,6 +1,6 @@ /* - * DISTRHO Plugin Toolkit (DPT) - * Copyright (C) 2012-2013 Filipe Coelho + * DISTRHO Plugin Framework (DPF) + * Copyright (C) 2012-2014 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/libs/distrho/src/DistrhoPluginLADSPA+DSSI.cpp b/libs/distrho/src/DistrhoPluginLADSPA+DSSI.cpp index 861a4b45..2a2b1826 100644 --- a/libs/distrho/src/DistrhoPluginLADSPA+DSSI.cpp +++ b/libs/distrho/src/DistrhoPluginLADSPA+DSSI.cpp @@ -1,6 +1,6 @@ /* - * DISTRHO Plugin Toolkit (DPT) - * Copyright (C) 2012-2013 Filipe Coelho + * DISTRHO Plugin Framework (DPF) + * Copyright (C) 2012-2014 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/libs/distrho/src/DistrhoPluginLV2.cpp b/libs/distrho/src/DistrhoPluginLV2.cpp index 4c1d9c33..64d87897 100644 --- a/libs/distrho/src/DistrhoPluginLV2.cpp +++ b/libs/distrho/src/DistrhoPluginLV2.cpp @@ -1,6 +1,6 @@ /* - * DISTRHO Plugin Toolkit (DPT) - * Copyright (C) 2012-2013 Filipe Coelho + * DISTRHO Plugin Framework (DPF) + * Copyright (C) 2012-2014 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/libs/distrho/src/DistrhoPluginLV2export.cpp b/libs/distrho/src/DistrhoPluginLV2export.cpp index 5240c63d..b78b3037 100644 --- a/libs/distrho/src/DistrhoPluginLV2export.cpp +++ b/libs/distrho/src/DistrhoPluginLV2export.cpp @@ -1,6 +1,6 @@ /* - * DISTRHO Plugin Toolkit (DPT) - * Copyright (C) 2012-2013 Filipe Coelho + * DISTRHO Plugin Framework (DPF) + * Copyright (C) 2012-2014 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/libs/distrho/src/DistrhoPluginVST.cpp b/libs/distrho/src/DistrhoPluginVST.cpp index 915718eb..98a17a96 100644 --- a/libs/distrho/src/DistrhoPluginVST.cpp +++ b/libs/distrho/src/DistrhoPluginVST.cpp @@ -1,6 +1,6 @@ /* - * DISTRHO Plugin Toolkit (DPT) - * Copyright (C) 2012-2013 Filipe Coelho + * DISTRHO Plugin Framework (DPF) + * Copyright (C) 2012-2014 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/libs/distrho/src/DistrhoUI.cpp b/libs/distrho/src/DistrhoUI.cpp index 25e4965b..eda6412f 100644 --- a/libs/distrho/src/DistrhoUI.cpp +++ b/libs/distrho/src/DistrhoUI.cpp @@ -1,6 +1,6 @@ /* - * DISTRHO Plugin Toolkit (DPT) - * Copyright (C) 2012-2013 Filipe Coelho + * DISTRHO Plugin Framework (DPF) + * Copyright (C) 2012-2014 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/libs/distrho/src/DistrhoUIDSSI.cpp b/libs/distrho/src/DistrhoUIDSSI.cpp index 35436991..e59a9606 100644 --- a/libs/distrho/src/DistrhoUIDSSI.cpp +++ b/libs/distrho/src/DistrhoUIDSSI.cpp @@ -1,6 +1,6 @@ /* - * DISTRHO Plugin Toolkit (DPT) - * Copyright (C) 2012-2013 Filipe Coelho + * DISTRHO Plugin Framework (DPF) + * Copyright (C) 2012-2014 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/libs/distrho/src/DistrhoUIInternal.hpp b/libs/distrho/src/DistrhoUIInternal.hpp index 3fe8d812..fae40cee 100644 --- a/libs/distrho/src/DistrhoUIInternal.hpp +++ b/libs/distrho/src/DistrhoUIInternal.hpp @@ -1,6 +1,6 @@ /* - * DISTRHO Plugin Toolkit (DPT) - * Copyright (C) 2012-2013 Filipe Coelho + * DISTRHO Plugin Framework (DPF) + * Copyright (C) 2012-2014 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/libs/distrho/src/DistrhoUILV2.cpp b/libs/distrho/src/DistrhoUILV2.cpp index b1e5a36d..9bb6acf5 100644 --- a/libs/distrho/src/DistrhoUILV2.cpp +++ b/libs/distrho/src/DistrhoUILV2.cpp @@ -1,6 +1,6 @@ /* - * DISTRHO Plugin Toolkit (DPT) - * Copyright (C) 2012-2013 Filipe Coelho + * DISTRHO Plugin Framework (DPF) + * Copyright (C) 2012-2014 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