From 1c278ae279074a7116f757fdc16ca96a1607a6f5 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Tue, 24 Oct 2017 02:00:42 -0400 Subject: [PATCH] Added 8VERT --- res/8VERT.svg | 588 ++++++++++++++++++++++++++++++++++++++++++++ src/8VERT.cpp | 83 +++++++ src/Fundamental.cpp | 1 + src/Fundamental.hpp | 4 + 4 files changed, 676 insertions(+) create mode 100644 res/8VERT.svg create mode 100644 src/8VERT.cpp diff --git a/res/8VERT.svg b/res/8VERT.svg new file mode 100644 index 0000000..518bb3a --- /dev/null +++ b/res/8VERT.svg @@ -0,0 +1,588 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/8VERT.cpp b/src/8VERT.cpp new file mode 100644 index 0000000..2431ed0 --- /dev/null +++ b/src/8VERT.cpp @@ -0,0 +1,83 @@ +#include "Fundamental.hpp" + + +struct _8VERT : Module { + enum ParamIds { + NUM_PARAMS = 8 + }; + enum InputIds { + NUM_INPUTS = 8 + }; + enum OutputIds { + NUM_OUTPUTS = 8 + }; + enum LightIds { + NUM_LIGHTS = 8 + }; + + _8VERT() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS) {} + void step() override; +}; + +void _8VERT::step() { + float lastIn = 10.0; + for (int i = 0; i < 8; i++) { + lastIn = inputs[i].normalize(lastIn); + float out = lastIn * params[i].value; + outputs[i].value = out; + lights[i].value = out / 10.0; + } +} + + +_8VERTWidget::_8VERTWidget() { + _8VERT *module = new _8VERT(); + setModule(module); + box.size = Vec(8 * RACK_GRID_WIDTH, RACK_GRID_HEIGHT); + + SVGPanel *panel = new SVGPanel(); + panel->box.size = box.size; + panel->setBackground(SVG::load(assetPlugin(plugin, "res/8VERT.svg"))); + addChild(panel); + + addChild(createScrew(Vec(15, 0))); + addChild(createScrew(Vec(box.size.x - 30, 0))); + addChild(createScrew(Vec(15, 365))); + addChild(createScrew(Vec(box.size.x - 30, 365))); + + addParam(createParam(Vec(45, 48), module, 0, -1.0, 1.0, 0.0)); + addParam(createParam(Vec(45, 86), module, 1, -1.0, 1.0, 0.0)); + addParam(createParam(Vec(45, 125), module, 2, -1.0, 1.0, 0.0)); + addParam(createParam(Vec(45, 163), module, 3, -1.0, 1.0, 0.0)); + addParam(createParam(Vec(45, 202), module, 4, -1.0, 1.0, 0.0)); + addParam(createParam(Vec(45, 240), module, 5, -1.0, 1.0, 0.0)); + addParam(createParam(Vec(45, 278), module, 6, -1.0, 1.0, 0.0)); + addParam(createParam(Vec(45, 317), module, 7, -1.0, 1.0, 0.0)); + + addInput(createInput(Vec(10, 50), module, 0)); + addInput(createInput(Vec(10, 89), module, 1)); + addInput(createInput(Vec(10, 127), module, 2)); + addInput(createInput(Vec(10, 166), module, 3)); + addInput(createInput(Vec(10, 204), module, 4)); + addInput(createInput(Vec(10, 243), module, 5)); + addInput(createInput(Vec(10, 281), module, 6)); + addInput(createInput(Vec(10, 320), module, 7)); + + addOutput(createOutput(Vec(86, 50), module, 0)); + addOutput(createOutput(Vec(86, 89), module, 1)); + addOutput(createOutput(Vec(86, 127), module, 2)); + addOutput(createOutput(Vec(86, 166), module, 3)); + addOutput(createOutput(Vec(86, 204), module, 4)); + addOutput(createOutput(Vec(86, 243), module, 5)); + addOutput(createOutput(Vec(86, 281), module, 6)); + addOutput(createOutput(Vec(86, 320), module, 7)); + + addChild(createValueLight>(Vec(107, 49), &module->lights[0].value)); + addChild(createValueLight>(Vec(107, 88), &module->lights[1].value)); + addChild(createValueLight>(Vec(107, 126), &module->lights[2].value)); + addChild(createValueLight>(Vec(107, 165), &module->lights[3].value)); + addChild(createValueLight>(Vec(107, 203), &module->lights[4].value)); + addChild(createValueLight>(Vec(107, 242), &module->lights[5].value)); + addChild(createValueLight>(Vec(107, 280), &module->lights[6].value)); + addChild(createValueLight>(Vec(107, 319), &module->lights[7].value)); +} diff --git a/src/Fundamental.cpp b/src/Fundamental.cpp index c395de1..9b0367d 100644 --- a/src/Fundamental.cpp +++ b/src/Fundamental.cpp @@ -18,6 +18,7 @@ void init(rack::Plugin *p) { p->addModel(createModel("Fundamental", "Fundamental", "Delay", "Delay")); p->addModel(createModel("Fundamental", "Fundamental", "ADSR", "ADSR")); p->addModel(createModel("Fundamental", "Fundamental", "VCMixer", "VC Mixer")); + p->addModel(createModel<_8VERTWidget>("Fundamental", "Fundamental", "8VERT", "8VERT")); p->addModel(createModel("Fundamental", "Fundamental", "Scope", "Scope")); p->addModel(createModel("Fundamental", "Fundamental", "SEQ3", "SEQ-3")); } diff --git a/src/Fundamental.hpp b/src/Fundamental.hpp index cf1e6d1..74aa0c2 100644 --- a/src/Fundamental.hpp +++ b/src/Fundamental.hpp @@ -46,6 +46,10 @@ struct VCMixerWidget : ModuleWidget { VCMixerWidget(); }; +struct _8VERTWidget : ModuleWidget { + _8VERTWidget(); +}; + struct ScopeWidget : ModuleWidget { ScopeWidget(); };