diff --git a/res/DSEG-LICENSE.txt b/res/DSEG-LICENSE.txt new file mode 100755 index 0000000..ad4c0bf --- /dev/null +++ b/res/DSEG-LICENSE.txt @@ -0,0 +1,95 @@ +Copyright (c) 2017, keshikan (http://www.keshikan.net), +with Reserved Font Name "DSEG". + + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/res/DSEG7ClassicMini-Bold.ttf b/res/DSEG7ClassicMini-Bold.ttf new file mode 100755 index 0000000..4cdd3e7 Binary files /dev/null and b/res/DSEG7ClassicMini-Bold.ttf differ diff --git a/res/DSEG7ClassicMini-BoldItalic.ttf b/res/DSEG7ClassicMini-BoldItalic.ttf new file mode 100644 index 0000000..81a895e Binary files /dev/null and b/res/DSEG7ClassicMini-BoldItalic.ttf differ diff --git a/res/Merge.svg b/res/Merge.svg index 861ac8f..cbb554a 100644 --- a/res/Merge.svg +++ b/res/Merge.svg @@ -1,6 +1,4 @@ - - - - + id="svg132" + sodipodi:docname="MERGE.svg" + inkscape:version="0.92.3 (2405546, 2018-03-11)"> + id="metadata136"> image/svg+xml - + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + id="f39dfd3f-f470-46a6-8d6e-edc86f15578f" + data-name="FND BG"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/res/Split.svg b/res/Split.svg index 51c88ce..498a88b 100644 --- a/res/Split.svg +++ b/res/Split.svg @@ -1,6 +1,4 @@ - - - - + id="svg132" + sodipodi:docname="SPLIT.svg" + inkscape:version="0.92.3 (2405546, 2018-03-11)"> + id="metadata136"> image/svg+xml - + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + id="ad801b06-58dc-4a73-ad49-57908275371c" + data-name="FND BG"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Merge.cpp b/src/Merge.cpp index eff22dc..2daf960 100644 --- a/src/Merge.cpp +++ b/src/Merge.cpp @@ -19,7 +19,8 @@ struct Merge : Module { }; dsp::ClockDivider lightDivider; - int channels; + int channels = -1; + int automaticChannels = 0; Merge() { config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS); @@ -45,17 +46,10 @@ struct Merge : Module { } outputs[POLY_OUTPUT].setVoltage(v, c); } + automaticChannels = lastChannel + 1; - // In order to allow 0 channels, modify channels directly instead of using `setChannels()` - outputs[POLY_OUTPUT].channels = (channels >= 0) ? channels : (lastChannel + 1); - - // Set channel lights infrequently - if (lightDivider.process()) { - for (int c = 0; c < 16; c++) { - bool active = (c < outputs[POLY_OUTPUT].getChannels()); - lights[CHANNEL_LIGHTS + c].setBrightness(active); - } - } + // In order to allow 0 channels, modify `channels` directly instead of using `setChannels()` + outputs[POLY_OUTPUT].channels = (channels >= 0) ? channels : automaticChannels; } json_t* dataToJson() override { @@ -72,6 +66,21 @@ struct Merge : Module { }; +struct MergeChannelDisplay : ChannelDisplay { + Merge* module; + void step() override { + int channels = 16; + if (module) { + channels = module->channels; + if (channels < 0) + channels = module->automaticChannels; + } + + text = string::f("%d", channels); + } +}; + + struct MergeWidget : ModuleWidget { MergeWidget(Merge* module) { setModule(module); @@ -82,41 +91,29 @@ struct MergeWidget : ModuleWidget { 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))); - addInput(createInputCentered(mm2px(Vec(6.771, 37.02)), module, Merge::MONO_INPUTS + 0)); - addInput(createInputCentered(mm2px(Vec(6.771, 48.02)), module, Merge::MONO_INPUTS + 1)); - addInput(createInputCentered(mm2px(Vec(6.77, 59.02)), module, Merge::MONO_INPUTS + 2)); - addInput(createInputCentered(mm2px(Vec(6.77, 70.02)), module, Merge::MONO_INPUTS + 3)); - addInput(createInputCentered(mm2px(Vec(6.77, 81.02)), module, Merge::MONO_INPUTS + 4)); - addInput(createInputCentered(mm2px(Vec(6.77, 92.02)), module, Merge::MONO_INPUTS + 5)); - addInput(createInputCentered(mm2px(Vec(6.771, 103.02)), module, Merge::MONO_INPUTS + 6)); - addInput(createInputCentered(mm2px(Vec(6.771, 114.02)), module, Merge::MONO_INPUTS + 7)); - addInput(createInputCentered(mm2px(Vec(18.275, 37.02)), module, Merge::MONO_INPUTS + 8)); - addInput(createInputCentered(mm2px(Vec(18.275, 48.02)), module, Merge::MONO_INPUTS + 9)); - addInput(createInputCentered(mm2px(Vec(18.274, 59.02)), module, Merge::MONO_INPUTS + 10)); - addInput(createInputCentered(mm2px(Vec(18.274, 70.02)), module, Merge::MONO_INPUTS + 11)); - addInput(createInputCentered(mm2px(Vec(18.274, 81.02)), module, Merge::MONO_INPUTS + 12)); - addInput(createInputCentered(mm2px(Vec(18.274, 92.02)), module, Merge::MONO_INPUTS + 13)); - addInput(createInputCentered(mm2px(Vec(18.275, 103.02)), module, Merge::MONO_INPUTS + 14)); - addInput(createInputCentered(mm2px(Vec(18.275, 114.02)), module, Merge::MONO_INPUTS + 15)); - - addOutput(createOutputCentered(mm2px(Vec(6.77, 21.347)), module, Merge::POLY_OUTPUT)); - - addChild(createLightCentered>(mm2px(Vec(15.276, 17.775)), module, Merge::CHANNEL_LIGHTS + 0)); - addChild(createLightCentered>(mm2px(Vec(17.275, 17.775)), module, Merge::CHANNEL_LIGHTS + 1)); - addChild(createLightCentered>(mm2px(Vec(19.275, 17.775)), module, Merge::CHANNEL_LIGHTS + 2)); - addChild(createLightCentered>(mm2px(Vec(21.275, 17.775)), module, Merge::CHANNEL_LIGHTS + 3)); - addChild(createLightCentered>(mm2px(Vec(15.276, 19.775)), module, Merge::CHANNEL_LIGHTS + 4)); - addChild(createLightCentered>(mm2px(Vec(17.275, 19.775)), module, Merge::CHANNEL_LIGHTS + 5)); - addChild(createLightCentered>(mm2px(Vec(19.275, 19.775)), module, Merge::CHANNEL_LIGHTS + 6)); - addChild(createLightCentered>(mm2px(Vec(21.275, 19.775)), module, Merge::CHANNEL_LIGHTS + 7)); - addChild(createLightCentered>(mm2px(Vec(15.276, 21.775)), module, Merge::CHANNEL_LIGHTS + 8)); - addChild(createLightCentered>(mm2px(Vec(17.275, 21.775)), module, Merge::CHANNEL_LIGHTS + 9)); - addChild(createLightCentered>(mm2px(Vec(19.275, 21.775)), module, Merge::CHANNEL_LIGHTS + 10)); - addChild(createLightCentered>(mm2px(Vec(21.276, 21.775)), module, Merge::CHANNEL_LIGHTS + 11)); - addChild(createLightCentered>(mm2px(Vec(15.276, 23.775)), module, Merge::CHANNEL_LIGHTS + 12)); - addChild(createLightCentered>(mm2px(Vec(17.275, 23.775)), module, Merge::CHANNEL_LIGHTS + 13)); - addChild(createLightCentered>(mm2px(Vec(19.275, 23.775)), module, Merge::CHANNEL_LIGHTS + 14)); - addChild(createLightCentered>(mm2px(Vec(21.276, 23.775)), module, Merge::CHANNEL_LIGHTS + 15)); + addInput(createInputCentered(mm2px(Vec(7.281, 41.995)), module, Merge::MONO_INPUTS + 0)); + addInput(createInputCentered(mm2px(Vec(7.281, 52.155)), module, Merge::MONO_INPUTS + 1)); + addInput(createInputCentered(mm2px(Vec(7.281, 62.315)), module, Merge::MONO_INPUTS + 2)); + addInput(createInputCentered(mm2px(Vec(7.281, 72.475)), module, Merge::MONO_INPUTS + 3)); + addInput(createInputCentered(mm2px(Vec(7.281, 82.635)), module, Merge::MONO_INPUTS + 4)); + addInput(createInputCentered(mm2px(Vec(7.281, 92.795)), module, Merge::MONO_INPUTS + 5)); + addInput(createInputCentered(mm2px(Vec(7.281, 102.955)), module, Merge::MONO_INPUTS + 6)); + addInput(createInputCentered(mm2px(Vec(7.281, 113.115)), module, Merge::MONO_INPUTS + 7)); + addInput(createInputCentered(mm2px(Vec(18.119, 41.995)), module, Merge::MONO_INPUTS + 8)); + addInput(createInputCentered(mm2px(Vec(18.119, 52.155)), module, Merge::MONO_INPUTS + 9)); + addInput(createInputCentered(mm2px(Vec(18.119, 62.315)), module, Merge::MONO_INPUTS + 10)); + addInput(createInputCentered(mm2px(Vec(18.119, 72.475)), module, Merge::MONO_INPUTS + 11)); + addInput(createInputCentered(mm2px(Vec(18.119, 82.635)), module, Merge::MONO_INPUTS + 12)); + addInput(createInputCentered(mm2px(Vec(18.119, 92.795)), module, Merge::MONO_INPUTS + 13)); + addInput(createInputCentered(mm2px(Vec(18.119, 102.955)), module, Merge::MONO_INPUTS + 14)); + addInput(createInputCentered(mm2px(Vec(18.119, 113.115)), module, Merge::MONO_INPUTS + 15)); + + addOutput(createOutputCentered(mm2px(Vec(7.281, 21.967)), module, Merge::POLY_OUTPUT)); + + MergeChannelDisplay* display = createWidget(mm2px(Vec(14.02, 18.611))); + display->box.size = mm2px(Vec(8.197, 8.197)); + display->module = module; + addChild(display); } void appendContextMenu(Menu* menu) override { @@ -124,24 +121,15 @@ struct MergeWidget : ModuleWidget { menu->addChild(new MenuSeparator); - struct MergeChannelsItem : MenuItem { - Merge* module; - Menu* createChildMenu() override { - Menu* menu = new Menu; - for (int c = -1; c <= 16; c++) { - menu->addChild(createCheckMenuItem((c < 0) ? "Automatic" : string::f("%d", c), "", - [=]() {return module->channels == c;}, - [=]() {module->channels = c;} - )); - } - return menu; - } - }; - MergeChannelsItem* channelsItem = new MergeChannelsItem; - channelsItem->text = "Channels"; - channelsItem->rightText = RIGHT_ARROW; - channelsItem->module = module; - menu->addChild(channelsItem); + std::vector channelLabels; + channelLabels.push_back(string::f("Automatic (%d)", module->automaticChannels)); + for (int i = 0; i <= 16; i++) { + channelLabels.push_back(string::f("%d", i)); + } + menu->addChild(createIndexSubmenuItem("Channels", channelLabels, + [=]() {return module->channels + 1;}, + [=](int i) {module->channels = i - 1;} + )); } }; diff --git a/src/Split.cpp b/src/Split.cpp index c2e95dd..d69e334 100644 --- a/src/Split.cpp +++ b/src/Split.cpp @@ -18,12 +18,13 @@ struct Split : Module { NUM_LIGHTS }; + int lastChannels = 0; dsp::ClockDivider lightDivider; Split() { config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS); configInput(POLY_INPUT, "Polyphonic"); - for (int i = 0; i < 8; i++) + for (int i = 0; i < 16; i++) configOutput(MONO_OUTPUTS + i, string::f("Channel %d", i + 1)); lightDivider.setDivision(512); @@ -36,13 +37,16 @@ struct Split : Module { outputs[MONO_OUTPUTS + c].setVoltage(v); } - // Set channel lights infrequently - if (lightDivider.process()) { - for (int c = 0; c < 16; c++) { - bool active = (c < inputs[POLY_INPUT].getChannels()); - lights[CHANNEL_LIGHTS + c].setBrightness(active); - } - } + lastChannels = inputs[POLY_INPUT].getChannels(); + } +}; + + +struct SplitChannelDisplay : ChannelDisplay { + Split* module; + void step() override { + int channels = module ? module->lastChannels : 16; + text = string::f("%d", channels); } }; @@ -57,41 +61,29 @@ struct SplitWidget : ModuleWidget { 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))); - addInput(createInputCentered(mm2px(Vec(6.77, 21.347)), module, Split::POLY_INPUT)); - - addOutput(createOutputCentered(mm2px(Vec(6.771, 37.02)), module, Split::MONO_OUTPUTS + 0)); - addOutput(createOutputCentered(mm2px(Vec(6.771, 48.02)), module, Split::MONO_OUTPUTS + 1)); - addOutput(createOutputCentered(mm2px(Vec(6.77, 59.02)), module, Split::MONO_OUTPUTS + 2)); - addOutput(createOutputCentered(mm2px(Vec(6.77, 70.02)), module, Split::MONO_OUTPUTS + 3)); - addOutput(createOutputCentered(mm2px(Vec(6.77, 81.02)), module, Split::MONO_OUTPUTS + 4)); - addOutput(createOutputCentered(mm2px(Vec(6.77, 92.02)), module, Split::MONO_OUTPUTS + 5)); - addOutput(createOutputCentered(mm2px(Vec(6.771, 103.02)), module, Split::MONO_OUTPUTS + 6)); - addOutput(createOutputCentered(mm2px(Vec(6.771, 114.02)), module, Split::MONO_OUTPUTS + 7)); - addOutput(createOutputCentered(mm2px(Vec(18.275, 37.02)), module, Split::MONO_OUTPUTS + 8)); - addOutput(createOutputCentered(mm2px(Vec(18.275, 48.02)), module, Split::MONO_OUTPUTS + 9)); - addOutput(createOutputCentered(mm2px(Vec(18.274, 59.02)), module, Split::MONO_OUTPUTS + 10)); - addOutput(createOutputCentered(mm2px(Vec(18.274, 70.02)), module, Split::MONO_OUTPUTS + 11)); - addOutput(createOutputCentered(mm2px(Vec(18.274, 81.02)), module, Split::MONO_OUTPUTS + 12)); - addOutput(createOutputCentered(mm2px(Vec(18.274, 92.02)), module, Split::MONO_OUTPUTS + 13)); - addOutput(createOutputCentered(mm2px(Vec(18.275, 103.02)), module, Split::MONO_OUTPUTS + 14)); - addOutput(createOutputCentered(mm2px(Vec(18.275, 114.02)), module, Split::MONO_OUTPUTS + 15)); - - addChild(createLightCentered>(mm2px(Vec(15.276, 17.775)), module, Split::CHANNEL_LIGHTS + 0)); - addChild(createLightCentered>(mm2px(Vec(17.275, 17.775)), module, Split::CHANNEL_LIGHTS + 1)); - addChild(createLightCentered>(mm2px(Vec(19.275, 17.775)), module, Split::CHANNEL_LIGHTS + 2)); - addChild(createLightCentered>(mm2px(Vec(21.275, 17.775)), module, Split::CHANNEL_LIGHTS + 3)); - addChild(createLightCentered>(mm2px(Vec(15.276, 19.775)), module, Split::CHANNEL_LIGHTS + 4)); - addChild(createLightCentered>(mm2px(Vec(17.275, 19.775)), module, Split::CHANNEL_LIGHTS + 5)); - addChild(createLightCentered>(mm2px(Vec(19.275, 19.775)), module, Split::CHANNEL_LIGHTS + 6)); - addChild(createLightCentered>(mm2px(Vec(21.275, 19.775)), module, Split::CHANNEL_LIGHTS + 7)); - addChild(createLightCentered>(mm2px(Vec(15.276, 21.775)), module, Split::CHANNEL_LIGHTS + 8)); - addChild(createLightCentered>(mm2px(Vec(17.275, 21.775)), module, Split::CHANNEL_LIGHTS + 9)); - addChild(createLightCentered>(mm2px(Vec(19.275, 21.775)), module, Split::CHANNEL_LIGHTS + 10)); - addChild(createLightCentered>(mm2px(Vec(21.276, 21.775)), module, Split::CHANNEL_LIGHTS + 11)); - addChild(createLightCentered>(mm2px(Vec(15.276, 23.775)), module, Split::CHANNEL_LIGHTS + 12)); - addChild(createLightCentered>(mm2px(Vec(17.275, 23.775)), module, Split::CHANNEL_LIGHTS + 13)); - addChild(createLightCentered>(mm2px(Vec(19.275, 23.775)), module, Split::CHANNEL_LIGHTS + 14)); - addChild(createLightCentered>(mm2px(Vec(21.276, 23.775)), module, Split::CHANNEL_LIGHTS + 15)); + addInput(createInputCentered(mm2px(Vec(7.281, 21.967)), module, Split::POLY_INPUT)); + + addOutput(createOutputCentered(mm2px(Vec(7.281, 41.995)), module, Split::MONO_OUTPUTS + 0)); + addOutput(createOutputCentered(mm2px(Vec(7.281, 52.155)), module, Split::MONO_OUTPUTS + 1)); + addOutput(createOutputCentered(mm2px(Vec(7.281, 62.315)), module, Split::MONO_OUTPUTS + 2)); + addOutput(createOutputCentered(mm2px(Vec(7.281, 72.475)), module, Split::MONO_OUTPUTS + 3)); + addOutput(createOutputCentered(mm2px(Vec(7.281, 82.635)), module, Split::MONO_OUTPUTS + 4)); + addOutput(createOutputCentered(mm2px(Vec(7.281, 92.795)), module, Split::MONO_OUTPUTS + 5)); + addOutput(createOutputCentered(mm2px(Vec(7.281, 102.955)), module, Split::MONO_OUTPUTS + 6)); + addOutput(createOutputCentered(mm2px(Vec(7.281, 113.115)), module, Split::MONO_OUTPUTS + 7)); + addOutput(createOutputCentered(mm2px(Vec(18.119, 41.995)), module, Split::MONO_OUTPUTS + 8)); + addOutput(createOutputCentered(mm2px(Vec(18.119, 52.155)), module, Split::MONO_OUTPUTS + 9)); + addOutput(createOutputCentered(mm2px(Vec(18.119, 62.315)), module, Split::MONO_OUTPUTS + 10)); + addOutput(createOutputCentered(mm2px(Vec(18.119, 72.475)), module, Split::MONO_OUTPUTS + 11)); + addOutput(createOutputCentered(mm2px(Vec(18.119, 82.635)), module, Split::MONO_OUTPUTS + 12)); + addOutput(createOutputCentered(mm2px(Vec(18.119, 92.795)), module, Split::MONO_OUTPUTS + 13)); + addOutput(createOutputCentered(mm2px(Vec(18.119, 102.955)), module, Split::MONO_OUTPUTS + 14)); + addOutput(createOutputCentered(mm2px(Vec(18.119, 113.115)), module, Split::MONO_OUTPUTS + 15)); + + SplitChannelDisplay* display = createWidget(mm2px(Vec(14.02, 18.611))); + display->box.size = mm2px(Vec(8.197, 8.197)); + display->module = module; + addChild(display); } }; diff --git a/src/plugin.hpp b/src/plugin.hpp index d5dd055..57db473 100644 --- a/src/plugin.hpp +++ b/src/plugin.hpp @@ -33,3 +33,49 @@ extern Model* modelViz; extern Model* modelMidSide; extern Model* modelNoise; extern Model* modelRandom; + + +struct DigitalDisplay : Widget { + std::string fontPath; + std::string bgText; + std::string text; + float fontSize; + NVGcolor bgColor = nvgRGB(0x46,0x46, 0x46); + NVGcolor fgColor = SCHEME_YELLOW; + Vec textPos; + + void draw(const DrawArgs &args) override { + // Background + nvgBeginPath(args.vg); + nvgRoundedRect(args.vg, 0, 0, box.size.x, box.size.y, 2); + nvgFillColor(args.vg, nvgRGB(0x19, 0x19, 0x19)); + nvgFill(args.vg); + + // Get font + std::shared_ptr font = APP->window->loadFont(fontPath); + if (font->handle < 0) + return; + nvgFontFaceId(args.vg, font->handle); + nvgFontSize(args.vg, fontSize); + nvgTextLetterSpacing(args.vg, 0.0); + nvgTextAlign(args.vg, NVG_ALIGN_RIGHT); + + // Background text + nvgFillColor(args.vg, bgColor); + nvgText(args.vg, textPos.x, textPos.y, bgText.c_str(), NULL); + + // Foreground text + nvgFillColor(args.vg, fgColor); + nvgText(args.vg, textPos.x, textPos.y, text.c_str(), NULL); + } +}; + + +struct ChannelDisplay : DigitalDisplay { + ChannelDisplay() { + fontPath = asset::plugin(pluginInstance, "res/DSEG7ClassicMini-BoldItalic.ttf"); + textPos = Vec(22, 20); + bgText = "18"; + fontSize = 16; + } +};