diff --git a/lv2export/export.cpp b/lv2export/export.cpp index c058ea9..41fa179 100644 --- a/lv2export/export.cpp +++ b/lv2export/export.cpp @@ -15,25 +15,7 @@ * For a full copy of the GNU General Public License see the LICENSE file. */ -#ifndef PLUGIN_BRAND -# error PLUGIN_BRAND undefined -#endif - -#ifndef PLUGIN_LABEL -# error PLUGIN_LABEL undefined -#endif - -#ifndef PLUGIN_MODEL -# error PLUGIN_MODEL undefined -#endif - -#ifndef PLUGIN_CV_INPUTS -# error PLUGIN_CV_INPUTS undefined -#endif - -#ifndef PLUGIN_CV_OUTPUTS -# error PLUGIN_CV_OUTPUTS undefined -#endif +#include "lv2plugin.hpp" #include diff --git a/lv2export/lv2plugin.cpp b/lv2export/lv2plugin.cpp index e15e4b6..e2e2d52 100644 --- a/lv2export/lv2plugin.cpp +++ b/lv2export/lv2plugin.cpp @@ -15,26 +15,7 @@ * For a full copy of the GNU General Public License see the LICENSE file. */ -#ifndef PLUGIN_MODEL -# error PLUGIN_MODEL undefined -#endif - -#ifndef PLUGIN_CV_INPUTS -# error PLUGIN_CV_INPUTS undefined -#endif - -#ifndef PLUGIN_CV_OUTPUTS -# error PLUGIN_CV_OUTPUTS undefined -#endif - -enum PortType { - Audio = 0, - Bi = 1, - Uni = 2, -}; - -static constexpr const int kCvInputs[] = PLUGIN_CV_INPUTS; -static constexpr const int kCvOutputs[] = PLUGIN_CV_OUTPUTS; +#include "lv2plugin.hpp" #include "src/lv2/buf-size.h" #include "src/lv2/options.h" @@ -185,21 +166,19 @@ static LV2_Handle lv2_instantiate(const LV2_Descriptor*, double sampleRate, cons // ----------------------------------------------------------------------- -#define instancePtr ((PluginLv2*)instance) - static void lv2_connect_port(LV2_Handle instance, uint32_t port, void* dataLocation) { - instancePtr->lv2_connect_port(port, dataLocation); + static_cast(instance)->lv2_connect_port(port, dataLocation); } static void lv2_run(LV2_Handle instance, uint32_t sampleCount) { - instancePtr->lv2_run(sampleCount); + static_cast(instance)->lv2_run(sampleCount); } static void lv2_cleanup(LV2_Handle instance) { - delete instancePtr; + delete static_cast(instance); } // ----------------------------------------------------------------------- @@ -209,8 +188,6 @@ static const void* lv2_extension_data(const char* uri) return nullptr; } -#undef instancePtr - // ----------------------------------------------------------------------- static const LV2_Descriptor sLv2Descriptor = { diff --git a/lv2export/lv2plugin.hpp b/lv2export/lv2plugin.hpp new file mode 100644 index 0000000..25fc44d --- /dev/null +++ b/lv2export/lv2plugin.hpp @@ -0,0 +1,47 @@ +/* + * DISTRHO Cardinal Plugin + * Copyright (C) 2021-2022 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 3 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 LICENSE file. + */ + +#pragma once + +#ifndef PLUGIN_BRAND +# error PLUGIN_BRAND undefined +#endif + +#ifndef PLUGIN_LABEL +# error PLUGIN_LABEL undefined +#endif + +#ifndef PLUGIN_MODEL +# error PLUGIN_MODEL undefined +#endif + +#ifndef PLUGIN_CV_INPUTS +# error PLUGIN_CV_INPUTS undefined +#endif + +#ifndef PLUGIN_CV_OUTPUTS +# error PLUGIN_CV_OUTPUTS undefined +#endif + +enum PortType { + Audio = 0, + Bi = 1, + Uni = 2, +}; + +static constexpr const PortType kCvInputs[] = PLUGIN_CV_INPUTS; +static constexpr const PortType kCvOutputs[] = PLUGIN_CV_OUTPUTS; diff --git a/lv2export/plugins/aubileinstruments-macro-osc-2.cpp b/lv2export/plugins/aubileinstruments-macro-osc-2.cpp index 5e6d73e..d6afeb7 100644 --- a/lv2export/plugins/aubileinstruments-macro-osc-2.cpp +++ b/lv2export/plugins/aubileinstruments-macro-osc-2.cpp @@ -55,8 +55,8 @@ #define PLUGIN_BRAND "AudibleInstruments" #define PLUGIN_LABEL "Macro Osc 2" #define PLUGIN_MODEL modelPlaits -#define PLUGIN_CV_INPUTS {1,1,1,1,1,1,1,1} -#define PLUGIN_CV_OUTPUTS {0,0} +#define PLUGIN_CV_INPUTS {Bi,Bi,Bi,Bi,Bi,Bi,Bi,Bi} +#define PLUGIN_CV_OUTPUTS {Audio,Audio} #define PLUGIN_LV2_CATEGORY "lv2:GeneratorPlugin" #include "lv2plugin.cpp" diff --git a/lv2export/plugins/aubileinstruments-macro-osc.cpp b/lv2export/plugins/aubileinstruments-macro-osc.cpp index ed913e0..e196b26 100644 --- a/lv2export/plugins/aubileinstruments-macro-osc.cpp +++ b/lv2export/plugins/aubileinstruments-macro-osc.cpp @@ -35,8 +35,8 @@ #define PLUGIN_BRAND "AudibleInstruments" #define PLUGIN_LABEL "Macro Osc" #define PLUGIN_MODEL modelBraids -#define PLUGIN_CV_INPUTS {1,1,1,1,1} -#define PLUGIN_CV_OUTPUTS {0} +#define PLUGIN_CV_INPUTS {Bi,Bi,Bi,Bi,Bi} +#define PLUGIN_CV_OUTPUTS {Audio} #define PLUGIN_LV2_CATEGORY "lv2:GeneratorPlugin" #include "lv2plugin.cpp" diff --git a/lv2export/plugins/msm-phaser.cpp b/lv2export/plugins/msm-phaser.cpp index 8e93f86..08287a9 100644 --- a/lv2export/plugins/msm-phaser.cpp +++ b/lv2export/plugins/msm-phaser.cpp @@ -20,8 +20,8 @@ #define PLUGIN_BRAND "MSM" #define PLUGIN_LABEL "Phaser" #define PLUGIN_MODEL modelPhaserModule -#define PLUGIN_CV_INPUTS {1,1,1,0} -#define PLUGIN_CV_OUTPUTS {0} +#define PLUGIN_CV_INPUTS {Bi,Bi,Bi,Audio} +#define PLUGIN_CV_OUTPUTS {Audio} #define PLUGIN_LV2_CATEGORY "lv2:DistortionPlugin" #include "lv2plugin.cpp" diff --git a/lv2export/plugins/rackwindows-mv.cpp b/lv2export/plugins/rackwindows-mv.cpp index a7991ce..8540130 100644 --- a/lv2export/plugins/rackwindows-mv.cpp +++ b/lv2export/plugins/rackwindows-mv.cpp @@ -20,8 +20,8 @@ #define PLUGIN_BRAND "Rackwindows" #define PLUGIN_LABEL "MV" #define PLUGIN_MODEL modelMv -#define PLUGIN_CV_INPUTS {1,1,1,1,0,0} -#define PLUGIN_CV_OUTPUTS {0,0} +#define PLUGIN_CV_INPUTS {Bi,Bi,Bi,Bi,Audio,Audio} +#define PLUGIN_CV_OUTPUTS {Audio,Audio} #define PLUGIN_LV2_CATEGORY "lv2:ReverbPlugin" #include "lv2plugin.cpp" diff --git a/lv2export/plugins/rackwindows-vibrato.cpp b/lv2export/plugins/rackwindows-vibrato.cpp index a4bdd9e..96d88a3 100644 --- a/lv2export/plugins/rackwindows-vibrato.cpp +++ b/lv2export/plugins/rackwindows-vibrato.cpp @@ -20,8 +20,8 @@ #define PLUGIN_BRAND "Rackwindows" #define PLUGIN_LABEL "Vibrato" #define PLUGIN_MODEL modelVibrato -#define PLUGIN_CV_INPUTS {1,1,1,1,1,0} -#define PLUGIN_CV_OUTPUTS {1,0,1} +#define PLUGIN_CV_INPUTS {Bi,Bi,Bi,Bi,Bi,Audio} +#define PLUGIN_CV_OUTPUTS {Bi,Audio,Bi} #define PLUGIN_LV2_CATEGORY "lv2:DynamicsPlugin" #include "lv2plugin.cpp" diff --git a/lv2export/plugins/valleyaudio-plateau.cpp b/lv2export/plugins/valleyaudio-plateau.cpp index 9f4cc03..554bc96 100644 --- a/lv2export/plugins/valleyaudio-plateau.cpp +++ b/lv2export/plugins/valleyaudio-plateau.cpp @@ -23,8 +23,8 @@ #define PLUGIN_BRAND "Valley Audio" #define PLUGIN_LABEL "Plateau" #define PLUGIN_MODEL modelPlateau -#define PLUGIN_CV_INPUTS {0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1} -#define PLUGIN_CV_OUTPUTS {0,0} +#define PLUGIN_CV_INPUTS {Audio,Audio,Bi,Bi,Bi,Bi,Bi,Bi,Bi,Bi,Bi,Bi,Bi,Bi,Bi,Bi,Bi} +#define PLUGIN_CV_OUTPUTS {Audio,Audio} #define PLUGIN_LV2_CATEGORY "lv2:ReverbPlugin" #include "lv2plugin.cpp"