diff --git a/plugins/Cardinal/plugin.json b/plugins/Cardinal/plugin.json index bd34e19..8991d67 100644 --- a/plugins/Cardinal/plugin.json +++ b/plugins/Cardinal/plugin.json @@ -31,7 +31,6 @@ }, { "slug": "HostCV", - "disabled": false, "name": "Host CV", "description": "Exposes host-provided CV ports in a module", "tags": [ @@ -40,7 +39,6 @@ }, { "slug": "HostMIDI", - "disabled": false, "name": "Host MIDI", "description": "Exposes host-provided MIDI in a module", "tags": [ @@ -49,9 +47,35 @@ "Polyphonic" ] }, + { + "slug": "HostMIDICC", + "name": "Host MIDI CC", + "description": "Exposes host-provided MIDI CC in a module", + "tags": [ + "External", + "MIDI" + ] + }, + { + "slug": "HostMIDIGate", + "name": "Host MIDI Gate", + "description": "Exposes host-provided MIDI as gates in a module", + "tags": [ + "External", + "MIDI" + ] + }, + { + "slug": "HostMIDIMap", + "name": "Host MIDI Map", + "description": "Allows host-provided MIDI to control other module parameters", + "tags": [ + "External", + "MIDI" + ] + }, { "slug": "HostParameters", - "disabled": false, "name": "Host Parameters", "description": "Exposes host-controlled plugin parameters in a module", "tags": [ @@ -60,7 +84,6 @@ }, { "slug": "HostTime", - "disabled": false, "name": "Host Time", "description": "Exposes host-provided time/transport information in a module", "tags": [ @@ -69,7 +92,6 @@ }, { "slug": "glBars", - "disabled": false, "name": "glBars", "description": "OpenGL bars visualization, as seen in XMMS and XBMC/Kodi", "tags": [ @@ -78,7 +100,6 @@ }, { "slug": "Blank", - "disabled": false, "name": "Blank", "description": "Cardinal's own blank panel, featuring Hatsune Miku", "tags": [ @@ -87,7 +108,6 @@ }, { "slug": "AudioFile", - "disabled": false, "name": "Audio File", "description": "Audio file player as a module", "tags": [ @@ -96,7 +116,6 @@ }, { "slug": "Carla", - "disabled": false, "name": "Carla Plugin Host", "description": "A modular plugin host within Cardinal", "tags": [ @@ -105,7 +124,6 @@ }, { "slug": "Ildaeil", - "disabled": false, "name": "Ildaeil Plugin Host", "description": "A mini plugin host within Cardinal for loading any FX", "tags": [ @@ -114,7 +132,6 @@ }, { "slug": "MPV", - "disabled": false, "name": "MPV", "description": "An embed video player inside Cardinal", "tags": [ @@ -123,7 +140,6 @@ }, { "slug": "TextEditor", - "disabled": false, "name": "Text Editor", "description": "An embed text editor inside Cardinal", "tags": [ diff --git a/plugins/Cardinal/src/HostMIDI-CC.cpp b/plugins/Cardinal/src/HostMIDI-CC.cpp new file mode 100644 index 0000000..48aad06 --- /dev/null +++ b/plugins/Cardinal/src/HostMIDI-CC.cpp @@ -0,0 +1,125 @@ +/* + * 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. + */ + +/** + * This file contains a substantial amount of code from VCVRack's core/....cpp and core/....cpp + * Copyright (C) 2016-2021 VCV. + * + * 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 (at your option) any later version. + */ + +#include "plugincontext.hpp" + +#include + +// ----------------------------------------------------------------------------------------------------------- + +USE_NAMESPACE_DISTRHO; + +struct HostMIDICC : Module { + enum ParamIds { + NUM_PARAMS + }; + enum InputIds { + NUM_INPUTS + }; + enum OutputIds { + NUM_OUTPUTS + }; + enum LightIds { + NUM_LIGHTS + }; + + CardinalPluginContext* const pcontext; + + HostMIDICC() + : pcontext(static_cast(APP)) + { + if (pcontext == nullptr) + throw rack::Exception("Plugin context is null"); + + config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS); + } + + void onReset() override + { + } + + void process(const ProcessArgs& args) override + { + } + + json_t* dataToJson() override + { + json_t* const rootJ = json_object(); + DISTRHO_SAFE_ASSERT_RETURN(rootJ != nullptr, nullptr); + + return rootJ; + } + + void dataFromJson(json_t* rootJ) override + { + } +}; + +// -------------------------------------------------------------------------------------------------------------------- + +struct HostMIDICCWidget : ModuleWidget { + static constexpr const float startX_In = 14.0f; + static constexpr const float startX_Out = 96.0f; + static constexpr const float startY = 74.0f; + static constexpr const float padding = 29.0f; + static constexpr const float middleX = startX_In + (startX_Out - startX_In) * 0.5f + padding * 0.35f; + + HostMIDICC* const module; + + HostMIDICCWidget(HostMIDICC* const m) + : module(m) + { + setModule(m); + setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/HostMIDI.svg"))); + + addChild(createWidget(Vec(RACK_GRID_WIDTH, 0))); + addChild(createWidget(Vec(box.size.x - 2 * RACK_GRID_WIDTH, 0))); + addChild(createWidget(Vec(RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH))); + addChild(createWidget(Vec(box.size.x - 2 * RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH))); + } + + void draw(const DrawArgs& args) override + { + nvgBeginPath(args.vg); + nvgRect(args.vg, 0, 0, box.size.x, box.size.y); + nvgFillPaint(args.vg, nvgLinearGradient(args.vg, 0, 0, 0, box.size.y, + nvgRGB(0x18, 0x19, 0x19), nvgRGB(0x21, 0x22, 0x22))); + nvgFill(args.vg); + + ModuleWidget::draw(args); + } + + void appendContextMenu(Menu* const menu) override + { + } +}; + +// -------------------------------------------------------------------------------------------------------------------- + +Model* modelHostMIDICC = createModel("HostMIDICC"); + +// -------------------------------------------------------------------------------------------------------------------- diff --git a/plugins/Cardinal/src/HostMIDI-Gate.cpp b/plugins/Cardinal/src/HostMIDI-Gate.cpp new file mode 100644 index 0000000..48e98c1 --- /dev/null +++ b/plugins/Cardinal/src/HostMIDI-Gate.cpp @@ -0,0 +1,125 @@ +/* + * 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. + */ + +/** + * This file contains a substantial amount of code from VCVRack's core/....cpp and core/....cpp + * Copyright (C) 2016-2021 VCV. + * + * 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 (at your option) any later version. + */ + +#include "plugincontext.hpp" + +#include + +// ----------------------------------------------------------------------------------------------------------- + +USE_NAMESPACE_DISTRHO; + +struct HostMIDIGate : Module { + enum ParamIds { + NUM_PARAMS + }; + enum InputIds { + NUM_INPUTS + }; + enum OutputIds { + NUM_OUTPUTS + }; + enum LightIds { + NUM_LIGHTS + }; + + CardinalPluginContext* const pcontext; + + HostMIDIGate() + : pcontext(static_cast(APP)) + { + if (pcontext == nullptr) + throw rack::Exception("Plugin context is null"); + + config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS); + } + + void onReset() override + { + } + + void process(const ProcessArgs& args) override + { + } + + json_t* dataToJson() override + { + json_t* const rootJ = json_object(); + DISTRHO_SAFE_ASSERT_RETURN(rootJ != nullptr, nullptr); + + return rootJ; + } + + void dataFromJson(json_t* rootJ) override + { + } +}; + +// -------------------------------------------------------------------------------------------------------------------- + +struct HostMIDIGateWidget : ModuleWidget { + static constexpr const float startX_In = 14.0f; + static constexpr const float startX_Out = 96.0f; + static constexpr const float startY = 74.0f; + static constexpr const float padding = 29.0f; + static constexpr const float middleX = startX_In + (startX_Out - startX_In) * 0.5f + padding * 0.35f; + + HostMIDIGate* const module; + + HostMIDIGateWidget(HostMIDIGate* const m) + : module(m) + { + setModule(m); + setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/HostMIDI.svg"))); + + addChild(createWidget(Vec(RACK_GRID_WIDTH, 0))); + addChild(createWidget(Vec(box.size.x - 2 * RACK_GRID_WIDTH, 0))); + addChild(createWidget(Vec(RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH))); + addChild(createWidget(Vec(box.size.x - 2 * RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH))); + } + + void draw(const DrawArgs& args) override + { + nvgBeginPath(args.vg); + nvgRect(args.vg, 0, 0, box.size.x, box.size.y); + nvgFillPaint(args.vg, nvgLinearGradient(args.vg, 0, 0, 0, box.size.y, + nvgRGB(0x18, 0x19, 0x19), nvgRGB(0x21, 0x22, 0x22))); + nvgFill(args.vg); + + ModuleWidget::draw(args); + } + + void appendContextMenu(Menu* const menu) override + { + } +}; + +// -------------------------------------------------------------------------------------------------------------------- + +Model* modelHostMIDIGate = createModel("HostMIDIGate"); + +// -------------------------------------------------------------------------------------------------------------------- diff --git a/plugins/Cardinal/src/HostMIDI-Map.cpp b/plugins/Cardinal/src/HostMIDI-Map.cpp new file mode 100644 index 0000000..cc1d3fd --- /dev/null +++ b/plugins/Cardinal/src/HostMIDI-Map.cpp @@ -0,0 +1,125 @@ +/* + * 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. + */ + +/** + * This file contains a substantial amount of code from VCVRack's core/....cpp + * Copyright (C) 2016-2021 VCV. + * + * 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 (at your option) any later version. + */ + +#include "plugincontext.hpp" + +#include + +// ----------------------------------------------------------------------------------------------------------- + +USE_NAMESPACE_DISTRHO; + +struct HostMIDIMap : Module { + enum ParamIds { + NUM_PARAMS + }; + enum InputIds { + NUM_INPUTS + }; + enum OutputIds { + NUM_OUTPUTS + }; + enum LightIds { + NUM_LIGHTS + }; + + CardinalPluginContext* const pcontext; + + HostMIDIMap() + : pcontext(static_cast(APP)) + { + if (pcontext == nullptr) + throw rack::Exception("Plugin context is null"); + + config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS); + } + + void onReset() override + { + } + + void process(const ProcessArgs& args) override + { + } + + json_t* dataToJson() override + { + json_t* const rootJ = json_object(); + DISTRHO_SAFE_ASSERT_RETURN(rootJ != nullptr, nullptr); + + return rootJ; + } + + void dataFromJson(json_t* rootJ) override + { + } +}; + +// -------------------------------------------------------------------------------------------------------------------- + +struct HostMIDIMapWidget : ModuleWidget { + static constexpr const float startX_In = 14.0f; + static constexpr const float startX_Out = 96.0f; + static constexpr const float startY = 74.0f; + static constexpr const float padding = 29.0f; + static constexpr const float middleX = startX_In + (startX_Out - startX_In) * 0.5f + padding * 0.35f; + + HostMIDIMap* const module; + + HostMIDIMapWidget(HostMIDIMap* const m) + : module(m) + { + setModule(m); + setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/HostMIDI.svg"))); + + addChild(createWidget(Vec(RACK_GRID_WIDTH, 0))); + addChild(createWidget(Vec(box.size.x - 2 * RACK_GRID_WIDTH, 0))); + addChild(createWidget(Vec(RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH))); + addChild(createWidget(Vec(box.size.x - 2 * RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH))); + } + + void draw(const DrawArgs& args) override + { + nvgBeginPath(args.vg); + nvgRect(args.vg, 0, 0, box.size.x, box.size.y); + nvgFillPaint(args.vg, nvgLinearGradient(args.vg, 0, 0, 0, box.size.y, + nvgRGB(0x18, 0x19, 0x19), nvgRGB(0x21, 0x22, 0x22))); + nvgFill(args.vg); + + ModuleWidget::draw(args); + } + + void appendContextMenu(Menu* const menu) override + { + } +}; + +// -------------------------------------------------------------------------------------------------------------------- + +Model* modelHostMIDIMap = createModel("HostMIDIMap"); + +// -------------------------------------------------------------------------------------------------------------------- diff --git a/plugins/Cardinal/src/plugin.hpp b/plugins/Cardinal/src/plugin.hpp index f811140..6aee084 100644 --- a/plugins/Cardinal/src/plugin.hpp +++ b/plugins/Cardinal/src/plugin.hpp @@ -35,6 +35,9 @@ extern Model* modelHostAudio2; extern Model* modelHostAudio8; extern Model* modelHostCV; extern Model* modelHostMIDI; +extern Model* modelHostMIDICC; +extern Model* modelHostMIDIGate; +extern Model* modelHostMIDIMap; extern Model* modelHostParameters; extern Model* modelHostTime; extern Model* modelIldaeil; diff --git a/plugins/Makefile b/plugins/Makefile index 6a5076e..596b083 100644 --- a/plugins/Makefile +++ b/plugins/Makefile @@ -191,6 +191,9 @@ PLUGIN_FILES += Cardinal/src/glBars.cpp PLUGIN_FILES += Cardinal/src/HostAudio.cpp PLUGIN_FILES += Cardinal/src/HostCV.cpp PLUGIN_FILES += Cardinal/src/HostMIDI.cpp +PLUGIN_FILES += Cardinal/src/HostMIDI-CC.cpp +PLUGIN_FILES += Cardinal/src/HostMIDI-Gate.cpp +PLUGIN_FILES += Cardinal/src/HostMIDI-Map.cpp PLUGIN_FILES += Cardinal/src/HostParameters.cpp PLUGIN_FILES += Cardinal/src/HostTime.cpp PLUGIN_FILES += Cardinal/src/TextEditor.cpp diff --git a/plugins/plugins.cpp b/plugins/plugins.cpp index 63d1be7..1b764eb 100644 --- a/plugins/plugins.cpp +++ b/plugins/plugins.cpp @@ -721,6 +721,9 @@ static void initStatic__Cardinal() p->addModel(modelHostAudio8); p->addModel(modelHostCV); p->addModel(modelHostMIDI); + p->addModel(modelHostMIDICC); + p->addModel(modelHostMIDIGate); + p->addModel(modelHostMIDIMap); p->addModel(modelHostParameters); p->addModel(modelHostTime); p->addModel(modelTextEditor);