Rename current Cardinal as CardinalFX and add 10cv+audio variant

This commit is contained in:
falkTX 2021-11-09 18:09:40 +00:00
parent 5465b44705
commit f5920faaa3
14 changed files with 93 additions and 20 deletions

View file

@ -356,14 +356,14 @@ jobs:
done done
- name: Test VST2 plugin - name: Test VST2 plugin
run: | 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 \ env CARLA_BRIDGE_DUMMY=1 CARLA_BRIDGE_TESTING=native \
valgrind \ valgrind \
--error-exitcode=255 \ --error-exitcode=255 \
--leak-check=no \ --leak-check=no \
--track-origins=yes \ --track-origins=yes \
--suppressions=./dpf/utils/valgrind-dpf.supp \ --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 done
# - name: Test VST3 plugin # - name: Test VST3 plugin
# run: | # run: |

View file

@ -30,8 +30,8 @@
#define DISTRHO_UI_USE_NANOVG 1 #define DISTRHO_UI_USE_NANOVG 1
#define DISTRHO_UI_USER_RESIZABLE 1 #define DISTRHO_UI_USER_RESIZABLE 1
#endif #endif
#define DISTRHO_PLUGIN_NUM_INPUTS 2 #define DISTRHO_PLUGIN_NUM_INPUTS 12
#define DISTRHO_PLUGIN_NUM_OUTPUTS 2 #define DISTRHO_PLUGIN_NUM_OUTPUTS 12
#define DISTRHO_PLUGIN_WANT_MIDI_INPUT 1 #define DISTRHO_PLUGIN_WANT_MIDI_INPUT 1
#define DISTRHO_PLUGIN_WANT_MIDI_OUTPUT 1 #define DISTRHO_PLUGIN_WANT_MIDI_OUTPUT 1
#define DISTRHO_PLUGIN_WANT_FULL_STATE 1 #define DISTRHO_PLUGIN_WANT_FULL_STATE 1

View file

@ -0,0 +1 @@
../CardinalPlugin.cpp

View file

@ -0,0 +1 @@
../CardinalUI.cpp

View file

@ -0,0 +1,43 @@
/*
* DISTRHO Cardinal Plugin
* Copyright (C) 2021 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.
*/
#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

8
src/CardinalFX/Makefile Normal file
View file

@ -0,0 +1,8 @@
#!/usr/bin/make -f
# Makefile for DISTRHO Plugins #
# ---------------------------- #
# Created by falkTX
#
NAME = CardinalFX
include ../Makefile.cardinal.mk

1
src/CardinalFX/MenuBar.cpp Symbolic link
View file

@ -0,0 +1 @@
../override/MenuBar.cpp

View file

@ -0,0 +1 @@
../override/RemoteNanoVG.cpp

View file

@ -0,0 +1 @@
../override/RemoteWindow.cpp

1
src/CardinalFX/Window.cpp Symbolic link
View file

@ -0,0 +1 @@
../override/Window.cpp

1
src/CardinalFX/common.cpp Symbolic link
View file

@ -0,0 +1 @@
../override/common.cpp

View file

@ -510,6 +510,8 @@ protected:
{ {
#if DISTRHO_PLUGIN_IS_SYNTH #if DISTRHO_PLUGIN_IS_SYNTH
return "CardinalSynth"; return "CardinalSynth";
#elif DISTRHO_PLUGIN_NUM_INPUTS == 2
return "CardinalFX";
#else #else
return "Cardinal"; return "Cardinal";
#endif #endif
@ -546,6 +548,8 @@ protected:
{ {
#if DISTRHO_PLUGIN_IS_SYNTH #if DISTRHO_PLUGIN_IS_SYNTH
return d_cconst('d', 'C', 'n', 'S'); return d_cconst('d', 'C', 'n', 'S');
#elif DISTRHO_PLUGIN_NUM_INPUTS == 2
return d_cconst('d', 'C', 'n', 'F');
#else #else
return d_cconst('d', 'C', 'd', 'n'); return d_cconst('d', 'C', 'd', 'n');
#endif #endif
@ -554,6 +558,17 @@ protected:
/* -------------------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------------------
* Init */ * 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 void initParameter(const uint32_t index, Parameter& parameter) override
{ {
if (index < kModuleParameters) if (index < kModuleParameters)
@ -769,11 +784,11 @@ protected:
void activate() override void activate() override
{ {
const uint32_t bufferSize = getBufferSize() * DISTRHO_PLUGIN_NUM_OUTPUTS; const uint32_t bufferSize = getBufferSize();
fAudioBufferOut = new float[bufferSize]; fAudioBufferOut = new float[bufferSize * DISTRHO_PLUGIN_NUM_OUTPUTS];
#if DISTRHO_PLUGIN_NUM_INPUTS != 0 #if DISTRHO_PLUGIN_NUM_INPUTS != 0
fAudioBufferIn = new float[bufferSize]; fAudioBufferIn = new float[bufferSize * DISTRHO_PLUGIN_NUM_INPUTS];
std::memset(fAudioBufferIn, 0, sizeof(float)*bufferSize); std::memset(fAudioBufferIn, 0, sizeof(float)*bufferSize * DISTRHO_PLUGIN_NUM_INPUTS);
#endif #endif
fPreviousFrame = 0; fPreviousFrame = 0;
@ -856,7 +871,7 @@ protected:
fAudioBufferIn[j++] = inputs[0][i]; fAudioBufferIn[j++] = inputs[0][i];
fAudioBufferIn[j++] = inputs[1][i]; fAudioBufferIn[j++] = inputs[1][i];
} }
fCurrentAudioDevice->processInput(fAudioBufferIn, DISTRHO_PLUGIN_NUM_INPUTS, frames); fCurrentAudioDevice->processInput(fAudioBufferIn, 2, frames);
#endif #endif
} }
@ -864,8 +879,8 @@ protected:
if (fCurrentAudioDevice != nullptr) if (fCurrentAudioDevice != nullptr)
{ {
std::memset(fAudioBufferOut, 0, sizeof(float)*frames*DISTRHO_PLUGIN_NUM_OUTPUTS); std::memset(fAudioBufferOut, 0, sizeof(float)*frames*2);
fCurrentAudioDevice->processOutput(fAudioBufferOut, DISTRHO_PLUGIN_NUM_OUTPUTS, frames); fCurrentAudioDevice->processOutput(fAudioBufferOut, 2, frames);
for (uint32_t i=0, j=0; i<frames; ++i) for (uint32_t i=0, j=0; i<frames; ++i)
{ {

View file

@ -226,14 +226,12 @@ endif
BUILD_CXX_FLAGS += -DCARDINAL_PLUGIN_PREFIX='"$(PREFIX)"' BUILD_CXX_FLAGS += -DCARDINAL_PLUGIN_PREFIX='"$(PREFIX)"'
# -------------------------------------------------------------- # --------------------------------------------------------------
# Enable all possible plugin types # Enable all possible plugin types and setup resources
all: jack lv2 vst2 vst3 resources
# --------------------------------------------------------------
ifeq ($(NAME),Cardinal) ifeq ($(NAME),Cardinal)
all: jack lv2 resources
CORE_RESOURCES = $(filter-out icon.png,$(subst ../Rack/res/,,$(wildcard ../Rack/res/*))) template.vcv CORE_RESOURCES = $(filter-out icon.png,$(subst ../Rack/res/,,$(wildcard ../Rack/res/*))) template.vcv
PLUGIN_RESOURCES += $(CORE_RESOURCES:%=$(TARGET_DIR)/Cardinal.lv2/resources/%) PLUGIN_RESOURCES += $(CORE_RESOURCES:%=$(TARGET_DIR)/Cardinal.lv2/resources/%)
@ -246,6 +244,8 @@ PLUGIN_RESOURCES += $(CORE_RESOURCES:%=$(TARGET_DIR)/Cardinal.vst3/Contents/Reso
else else
all: jack lv2 vst2 vst3 resources
PLUGIN_RESOURCES += $(TARGET_DIR)/$(NAME).lv2/resources PLUGIN_RESOURCES += $(TARGET_DIR)/$(NAME).lv2/resources
ifeq ($(MACOS),true) ifeq ($(MACOS),true)
PLUGIN_RESOURCES += $(TARGET_DIR)/$(NAME).vst/Contents/Resources PLUGIN_RESOURCES += $(TARGET_DIR)/$(NAME).vst/Contents/Resources

View file

@ -37,12 +37,12 @@ struct CardinalAudioDevice : rack::audio::Device
int getNumInputs() override int getNumInputs() override
{ {
return DISTRHO_PLUGIN_NUM_INPUTS; return std::min(2, DISTRHO_PLUGIN_NUM_INPUTS);
} }
int getNumOutputs() override int getNumOutputs() override
{ {
return DISTRHO_PLUGIN_NUM_OUTPUTS; return std::min(2, DISTRHO_PLUGIN_NUM_OUTPUTS);
} }
int getBlockSize() override int getBlockSize() override
@ -109,12 +109,12 @@ struct CardinalAudioDriver : rack::audio::Driver
int getDeviceNumInputs(int) override int getDeviceNumInputs(int) override
{ {
return DISTRHO_PLUGIN_NUM_INPUTS; return std::min(2, DISTRHO_PLUGIN_NUM_INPUTS);
} }
int getDeviceNumOutputs(int) override int getDeviceNumOutputs(int) override
{ {
return DISTRHO_PLUGIN_NUM_OUTPUTS; return std::min(2, DISTRHO_PLUGIN_NUM_OUTPUTS);
} }
rack::audio::Device* subscribe(int, rack::audio::Port* const port) override rack::audio::Device* subscribe(int, rack::audio::Port* const port) override