diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bf8c6bf..92f059c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -356,14 +356,14 @@ jobs: done - name: Test VST2 plugin run: | - for p in $(ls bin/ | grep vst.so); do \ + for p in $(ls bin/ | grep vst); do \ env CARLA_BRIDGE_DUMMY=1 CARLA_BRIDGE_TESTING=native \ valgrind \ --error-exitcode=255 \ --leak-check=no \ --track-origins=yes \ --suppressions=./dpf/utils/valgrind-dpf.supp \ - /usr/lib/carla/carla-bridge-native vst2 ./bin/${p} "" 1>/dev/null; \ + /usr/lib/carla/carla-bridge-native vst2 ./bin/${p}/*.so "" 1>/dev/null; \ done # - name: Test VST3 plugin # run: | diff --git a/src/Cardinal/DistrhoPluginInfo.h b/src/Cardinal/DistrhoPluginInfo.h index 93dc94b..e9c65c3 100644 --- a/src/Cardinal/DistrhoPluginInfo.h +++ b/src/Cardinal/DistrhoPluginInfo.h @@ -30,8 +30,8 @@ #define DISTRHO_UI_USE_NANOVG 1 #define DISTRHO_UI_USER_RESIZABLE 1 #endif -#define DISTRHO_PLUGIN_NUM_INPUTS 2 -#define DISTRHO_PLUGIN_NUM_OUTPUTS 2 +#define DISTRHO_PLUGIN_NUM_INPUTS 12 +#define DISTRHO_PLUGIN_NUM_OUTPUTS 12 #define DISTRHO_PLUGIN_WANT_MIDI_INPUT 1 #define DISTRHO_PLUGIN_WANT_MIDI_OUTPUT 1 #define DISTRHO_PLUGIN_WANT_FULL_STATE 1 diff --git a/src/CardinalFX/CardinalPlugin.cpp b/src/CardinalFX/CardinalPlugin.cpp new file mode 120000 index 0000000..c0c7e71 --- /dev/null +++ b/src/CardinalFX/CardinalPlugin.cpp @@ -0,0 +1 @@ +../CardinalPlugin.cpp \ No newline at end of file diff --git a/src/CardinalFX/CardinalUI.cpp b/src/CardinalFX/CardinalUI.cpp new file mode 120000 index 0000000..5558256 --- /dev/null +++ b/src/CardinalFX/CardinalUI.cpp @@ -0,0 +1 @@ +../CardinalUI.cpp \ No newline at end of file diff --git a/src/CardinalFX/DistrhoPluginInfo.h b/src/CardinalFX/DistrhoPluginInfo.h new file mode 100644 index 0000000..90a1844 --- /dev/null +++ b/src/CardinalFX/DistrhoPluginInfo.h @@ -0,0 +1,43 @@ +/* + * DISTRHO Cardinal Plugin + * Copyright (C) 2021 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. + */ + +#ifndef DISTRHO_PLUGIN_INFO_H_INCLUDED +#define DISTRHO_PLUGIN_INFO_H_INCLUDED + +#define DISTRHO_PLUGIN_BRAND "DISTRHO" +#define DISTRHO_PLUGIN_NAME "Cardinal" +#define DISTRHO_PLUGIN_URI "https://distrho.kx.studio/plugins/cardinal#fx" + +#ifdef HEADLESS +#define DISTRHO_PLUGIN_HAS_UI 0 +#else +#define DISTRHO_PLUGIN_HAS_UI 1 +#define DISTRHO_PLUGIN_WANT_DIRECT_ACCESS 1 +#define DISTRHO_UI_USE_NANOVG 1 +#define DISTRHO_UI_USER_RESIZABLE 1 +#endif +#define DISTRHO_PLUGIN_NUM_INPUTS 2 +#define DISTRHO_PLUGIN_NUM_OUTPUTS 2 +#define DISTRHO_PLUGIN_WANT_MIDI_INPUT 1 +#define DISTRHO_PLUGIN_WANT_MIDI_OUTPUT 1 +#define DISTRHO_PLUGIN_WANT_FULL_STATE 1 +#define DISTRHO_PLUGIN_WANT_STATE 1 +#define DISTRHO_PLUGIN_WANT_TIMEPOS 1 +// #define DISTRHO_PLUGIN_LV2_CATEGORY "lv2:AnalyserPlugin" +// #define DISTRHO_PLUGIN_VST3_CATEGORIES "Fx|Analyzer" + +#endif // DISTRHO_PLUGIN_INFO_H_INCLUDED diff --git a/src/CardinalFX/Makefile b/src/CardinalFX/Makefile new file mode 100644 index 0000000..3a400ab --- /dev/null +++ b/src/CardinalFX/Makefile @@ -0,0 +1,8 @@ +#!/usr/bin/make -f +# Makefile for DISTRHO Plugins # +# ---------------------------- # +# Created by falkTX +# + +NAME = CardinalFX +include ../Makefile.cardinal.mk diff --git a/src/CardinalFX/MenuBar.cpp b/src/CardinalFX/MenuBar.cpp new file mode 120000 index 0000000..8d1a35a --- /dev/null +++ b/src/CardinalFX/MenuBar.cpp @@ -0,0 +1 @@ +../override/MenuBar.cpp \ No newline at end of file diff --git a/src/CardinalFX/RemoteNanoVG.cpp b/src/CardinalFX/RemoteNanoVG.cpp new file mode 120000 index 0000000..e6be4e7 --- /dev/null +++ b/src/CardinalFX/RemoteNanoVG.cpp @@ -0,0 +1 @@ +../override/RemoteNanoVG.cpp \ No newline at end of file diff --git a/src/CardinalFX/RemoteWindow.cpp b/src/CardinalFX/RemoteWindow.cpp new file mode 120000 index 0000000..52195ae --- /dev/null +++ b/src/CardinalFX/RemoteWindow.cpp @@ -0,0 +1 @@ +../override/RemoteWindow.cpp \ No newline at end of file diff --git a/src/CardinalFX/Window.cpp b/src/CardinalFX/Window.cpp new file mode 120000 index 0000000..759f272 --- /dev/null +++ b/src/CardinalFX/Window.cpp @@ -0,0 +1 @@ +../override/Window.cpp \ No newline at end of file diff --git a/src/CardinalFX/common.cpp b/src/CardinalFX/common.cpp new file mode 120000 index 0000000..915948e --- /dev/null +++ b/src/CardinalFX/common.cpp @@ -0,0 +1 @@ +../override/common.cpp \ No newline at end of file diff --git a/src/CardinalPlugin.cpp b/src/CardinalPlugin.cpp index 741c703..8ff62f0 100644 --- a/src/CardinalPlugin.cpp +++ b/src/CardinalPlugin.cpp @@ -510,6 +510,8 @@ protected: { #if DISTRHO_PLUGIN_IS_SYNTH return "CardinalSynth"; +#elif DISTRHO_PLUGIN_NUM_INPUTS == 2 + return "CardinalFX"; #else return "Cardinal"; #endif @@ -546,6 +548,8 @@ protected: { #if DISTRHO_PLUGIN_IS_SYNTH return d_cconst('d', 'C', 'n', 'S'); +#elif DISTRHO_PLUGIN_NUM_INPUTS == 2 + return d_cconst('d', 'C', 'n', 'F'); #else return d_cconst('d', 'C', 'd', 'n'); #endif @@ -554,6 +558,17 @@ protected: /* -------------------------------------------------------------------------------------------------------- * Init */ + void initAudioPort(const bool input, uint32_t index, AudioPort& port) override + { + if (index >= 2) + { + port.hints = kAudioPortIsCV | kCVPortHasPositiveUnipolarRange | kCVPortHasScaledRange; + index -= 2; + } + + CardinalBasePlugin::initAudioPort(input, index, port); + } + void initParameter(const uint32_t index, Parameter& parameter) override { if (index < kModuleParameters) @@ -769,11 +784,11 @@ protected: void activate() override { - const uint32_t bufferSize = getBufferSize() * DISTRHO_PLUGIN_NUM_OUTPUTS; - fAudioBufferOut = new float[bufferSize]; + const uint32_t bufferSize = getBufferSize(); + fAudioBufferOut = new float[bufferSize * DISTRHO_PLUGIN_NUM_OUTPUTS]; #if DISTRHO_PLUGIN_NUM_INPUTS != 0 - fAudioBufferIn = new float[bufferSize]; - std::memset(fAudioBufferIn, 0, sizeof(float)*bufferSize); + fAudioBufferIn = new float[bufferSize * DISTRHO_PLUGIN_NUM_INPUTS]; + std::memset(fAudioBufferIn, 0, sizeof(float)*bufferSize * DISTRHO_PLUGIN_NUM_INPUTS); #endif fPreviousFrame = 0; @@ -856,7 +871,7 @@ protected: fAudioBufferIn[j++] = inputs[0][i]; fAudioBufferIn[j++] = inputs[1][i]; } - fCurrentAudioDevice->processInput(fAudioBufferIn, DISTRHO_PLUGIN_NUM_INPUTS, frames); + fCurrentAudioDevice->processInput(fAudioBufferIn, 2, frames); #endif } @@ -864,8 +879,8 @@ protected: if (fCurrentAudioDevice != nullptr) { - std::memset(fAudioBufferOut, 0, sizeof(float)*frames*DISTRHO_PLUGIN_NUM_OUTPUTS); - fCurrentAudioDevice->processOutput(fAudioBufferOut, DISTRHO_PLUGIN_NUM_OUTPUTS, frames); + std::memset(fAudioBufferOut, 0, sizeof(float)*frames*2); + fCurrentAudioDevice->processOutput(fAudioBufferOut, 2, frames); for (uint32_t i=0, j=0; i