Experiments with Blank panels and oversampled images, go go miku!
Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
parent
6912f2a62b
commit
f6a4158510
9 changed files with 174 additions and 0 deletions
|
@ -49,6 +49,15 @@
|
||||||
"Visual"
|
"Visual"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"slug": "Blank",
|
||||||
|
"disabled": false,
|
||||||
|
"name": "Blank",
|
||||||
|
"description": "Cardinal's own blank panel",
|
||||||
|
"tags": [
|
||||||
|
"Visual"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"slug": "Carla",
|
"slug": "Carla",
|
||||||
"disabled": false,
|
"disabled": false,
|
||||||
|
|
48
plugins/Cardinal/res/Blank.svg
Normal file
48
plugins/Cardinal/res/Blank.svg
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
width="45.720001mm"
|
||||||
|
height="128.5mm"
|
||||||
|
viewBox="0 0 45.720001 128.5"
|
||||||
|
version="1.1"
|
||||||
|
id="svg4620"
|
||||||
|
inkscape:version="0.92.5 (2060ec1f9f, 2020-04-08)">
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="base"
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1.0"
|
||||||
|
inkscape:pageopacity="0.0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:zoom="1.979899"
|
||||||
|
inkscape:cx="45.251218"
|
||||||
|
inkscape:cy="441.73926"
|
||||||
|
inkscape:document-units="mm"
|
||||||
|
inkscape:current-layer="layer1"
|
||||||
|
showgrid="false"
|
||||||
|
inkscape:window-width="1920"
|
||||||
|
inkscape:window-height="1026"
|
||||||
|
inkscape:window-x="0"
|
||||||
|
inkscape:window-y="0"
|
||||||
|
inkscape:window-maximized="1" />
|
||||||
|
<metadata
|
||||||
|
id="metadata4617">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
<dc:title />
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.4 KiB |
BIN
plugins/Cardinal/res/Miku/Miku.png
Normal file
BIN
plugins/Cardinal/res/Miku/Miku.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 189 KiB |
2
plugins/Cardinal/res/Miku/notes.txt
Normal file
2
plugins/Cardinal/res/Miku/notes.txt
Normal file
|
@ -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
|
112
plugins/Cardinal/src/Blank.cpp
Normal file
112
plugins/Cardinal/src/Blank.cpp
Normal file
|
@ -0,0 +1,112 @@
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#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<ScrewBlack>(Vec(RACK_GRID_WIDTH, 0)));
|
||||||
|
addChild(createWidget<ScrewBlack>(Vec(box.size.x - 2 * RACK_GRID_WIDTH, 0)));
|
||||||
|
addChild(createWidget<ScrewBlack>(Vec(RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH)));
|
||||||
|
addChild(createWidget<ScrewBlack>(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<CardinalBlankModule, CardinalBlankWidget>("Blank");
|
|
@ -28,6 +28,7 @@ using namespace rack;
|
||||||
extern Plugin* pluginInstance;
|
extern Plugin* pluginInstance;
|
||||||
|
|
||||||
extern Model* modelCarla;
|
extern Model* modelCarla;
|
||||||
|
extern Model* modelCardinalBlank;
|
||||||
extern Model* modelGlBars;
|
extern Model* modelGlBars;
|
||||||
extern Model* modelHostCV;
|
extern Model* modelHostCV;
|
||||||
extern Model* modelHostParameters;
|
extern Model* modelHostParameters;
|
||||||
|
|
|
@ -177,6 +177,7 @@ PLUGIN_FILES = plugins.cpp
|
||||||
# --------------------------------------------------------------
|
# --------------------------------------------------------------
|
||||||
# Cardinal (built-in)
|
# Cardinal (built-in)
|
||||||
|
|
||||||
|
PLUGIN_FILES += Cardinal/src/Blank.cpp
|
||||||
PLUGIN_FILES += Cardinal/src/Carla.cpp
|
PLUGIN_FILES += Cardinal/src/Carla.cpp
|
||||||
PLUGIN_FILES += Cardinal/src/glBars.cpp
|
PLUGIN_FILES += Cardinal/src/glBars.cpp
|
||||||
PLUGIN_FILES += Cardinal/src/HostCV.cpp
|
PLUGIN_FILES += Cardinal/src/HostCV.cpp
|
||||||
|
|
|
@ -439,6 +439,7 @@ static void initStatic__Cardinal()
|
||||||
if (spl.ok())
|
if (spl.ok())
|
||||||
{
|
{
|
||||||
p->addModel(modelCarla);
|
p->addModel(modelCarla);
|
||||||
|
p->addModel(modelCardinalBlank);
|
||||||
p->addModel(modelGlBars);
|
p->addModel(modelGlBars);
|
||||||
p->addModel(modelHostCV);
|
p->addModel(modelHostCV);
|
||||||
p->addModel(modelHostParameters);
|
p->addModel(modelHostParameters);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue