Cleanup lv2export, split definitions into common file

Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
falkTX 2022-10-17 18:36:15 +01:00
parent 482ae564a0
commit 36d49e7471
No known key found for this signature in database
GPG key ID: CDBAA37ABC74FBA0
9 changed files with 64 additions and 58 deletions

View file

@ -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 <cstdio>

View file

@ -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<PluginLv2*>(instance)->lv2_connect_port(port, dataLocation);
}
static void lv2_run(LV2_Handle instance, uint32_t sampleCount)
{
instancePtr->lv2_run(sampleCount);
static_cast<PluginLv2*>(instance)->lv2_run(sampleCount);
}
static void lv2_cleanup(LV2_Handle instance)
{
delete instancePtr;
delete static_cast<PluginLv2*>(instance);
}
// -----------------------------------------------------------------------
@ -209,8 +188,6 @@ static const void* lv2_extension_data(const char* uri)
return nullptr;
}
#undef instancePtr
// -----------------------------------------------------------------------
static const LV2_Descriptor sLv2Descriptor = {

47
lv2export/lv2plugin.hpp Normal file
View file

@ -0,0 +1,47 @@
/*
* DISTRHO Cardinal Plugin
* Copyright (C) 2021-2022 Filipe Coelho <falktx@falktx.com>
*
* 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;

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"