diff --git a/plugins/Cardinal/plugin.json b/plugins/Cardinal/plugin.json
index fcb8397..d05bce0 100644
--- a/plugins/Cardinal/plugin.json
+++ b/plugins/Cardinal/plugin.json
@@ -49,6 +49,15 @@
"Visual"
]
},
+ {
+ "slug": "Blank",
+ "disabled": false,
+ "name": "Blank",
+ "description": "Cardinal's own blank panel",
+ "tags": [
+ "Visual"
+ ]
+ },
{
"slug": "Carla",
"disabled": false,
diff --git a/plugins/Cardinal/res/.gitkeep b/plugins/Cardinal/res/.gitkeep
deleted file mode 100644
index e69de29..0000000
diff --git a/plugins/Cardinal/res/Blank.svg b/plugins/Cardinal/res/Blank.svg
new file mode 100644
index 0000000..aafe5a8
--- /dev/null
+++ b/plugins/Cardinal/res/Blank.svg
@@ -0,0 +1,48 @@
+
+
+
+
diff --git a/plugins/Cardinal/res/Miku/Miku.png b/plugins/Cardinal/res/Miku/Miku.png
new file mode 100644
index 0000000..5dbab54
Binary files /dev/null and b/plugins/Cardinal/res/Miku/Miku.png differ
diff --git a/plugins/Cardinal/res/Miku/notes.txt b/plugins/Cardinal/res/Miku/notes.txt
new file mode 100644
index 0000000..a4d7c7c
--- /dev/null
+++ b/plugins/Cardinal/res/Miku/notes.txt
@@ -0,0 +1,2 @@
+Licensed under CC BY-NC (Creative Commons License - Attribution-NonCommercial, 3.0 Unported)
+See https://piapro.net/intl/en_for_creators.html
diff --git a/plugins/Cardinal/src/Blank.cpp b/plugins/Cardinal/src/Blank.cpp
new file mode 100644
index 0000000..d7e5188
--- /dev/null
+++ b/plugins/Cardinal/src/Blank.cpp
@@ -0,0 +1,112 @@
+/*
+ * 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.
+ */
+
+#include "plugin.hpp"
+
+struct CardinalBlankModule : Module {
+ enum ParamIds {
+ NUM_PARAMS
+ };
+ enum InputIds {
+ NUM_INPUTS
+ };
+ enum OutputIds {
+ NUM_OUTPUTS
+ };
+ enum LightIds {
+ NUM_LIGHTS
+ };
+
+ CardinalBlankModule() {
+ config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS);
+ }
+};
+
+struct CardinalBlankImage : OpaqueWidget {
+ int imageId = -2;
+ int imageWidth = 0;
+ int imageHeight = 0;
+
+ CardinalBlankImage(const math::Vec& size) {
+ box.size = size;
+ }
+
+ /*
+ ~CardinalBlankWidget()
+ {
+ if (imageId >= 0)
+ nvgDeleteImage(args.vg, imageId);
+ }
+ */
+
+ void draw(const DrawArgs& args) override
+ {
+ if (imageId == -2)
+ {
+ imageId = nvgCreateImage(args.vg, asset::plugin(pluginInstance, "res/Miku/Miku.png").c_str(), 0);
+
+ if (imageId != -1)
+ nvgImageSize(args.vg, imageId, &imageWidth, &imageHeight);
+ }
+
+ if (imageId != -1 && imageWidth != 0 && imageHeight != 0)
+ {
+ const float boxscale = std::min(box.size.x / imageWidth, box.size.y / imageHeight);
+ const float imgHeight = imageHeight * boxscale;
+ nvgBeginPath(args.vg);
+ nvgRect(args.vg, 0, 0, box.size.x, box.size.y);
+ nvgFillPaint(args.vg, nvgImagePattern(args.vg,
+ 0,
+ box.size.y * 0.5 - imgHeight * 0.5f,
+ box.size.x,
+ imageHeight * boxscale, 0, imageId, 1.0f));
+ nvgFill(args.vg);
+ }
+
+ OpaqueWidget::draw(args);
+ }
+};
+
+struct CardinalBlankWidget : ModuleWidget {
+ CardinalBlankWidget(CardinalBlankModule* const module) {
+ setModule(module);
+ setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Blank.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)));
+
+ FramebufferWidget* const fbWidget = new FramebufferWidget;
+ fbWidget->oversample = 2.0;
+ fbWidget->addChild(new CardinalBlankImage(box.size));
+ addChild(fbWidget);
+ }
+
+ 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);
+ }
+};
+
+Model* modelCardinalBlank = createModel("Blank");
diff --git a/plugins/Cardinal/src/plugin.hpp b/plugins/Cardinal/src/plugin.hpp
index f6ed020..08044cb 100644
--- a/plugins/Cardinal/src/plugin.hpp
+++ b/plugins/Cardinal/src/plugin.hpp
@@ -28,6 +28,7 @@ using namespace rack;
extern Plugin* pluginInstance;
extern Model* modelCarla;
+extern Model* modelCardinalBlank;
extern Model* modelGlBars;
extern Model* modelHostCV;
extern Model* modelHostParameters;
diff --git a/plugins/Makefile b/plugins/Makefile
index f940987..9e389ee 100644
--- a/plugins/Makefile
+++ b/plugins/Makefile
@@ -177,6 +177,7 @@ PLUGIN_FILES = plugins.cpp
# --------------------------------------------------------------
# Cardinal (built-in)
+PLUGIN_FILES += Cardinal/src/Blank.cpp
PLUGIN_FILES += Cardinal/src/Carla.cpp
PLUGIN_FILES += Cardinal/src/glBars.cpp
PLUGIN_FILES += Cardinal/src/HostCV.cpp
diff --git a/plugins/plugins.cpp b/plugins/plugins.cpp
index db0ec0d..ef96a35 100644
--- a/plugins/plugins.cpp
+++ b/plugins/plugins.cpp
@@ -439,6 +439,7 @@ static void initStatic__Cardinal()
if (spl.ok())
{
p->addModel(modelCarla);
+ p->addModel(modelCardinalBlank);
p->addModel(modelGlBars);
p->addModel(modelHostCV);
p->addModel(modelHostParameters);