From 65d2c16ca4038f41f52f59189ad6b5f65fd1c08f Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Fri, 10 Feb 2017 00:31:43 -0500 Subject: [PATCH] Updated build system, ModuleWidget constructor, Lights --- Makefile | 29 +++++++--------------- src/AudibleInstruments.cpp | 34 +++++++------------------- src/AudibleInstruments.hpp | 49 +++++++------------------------------- src/Blinds.cpp | 29 +++++++++++----------- src/Braids.cpp | 16 +++++++------ src/Branches.cpp | 13 +++++----- src/Clouds.cpp | 12 ++++++---- src/Elements.cpp | 17 ++++++------- src/Kinks.cpp | 15 ++++++------ src/Links.cpp | 21 ++++++++-------- src/Rings.cpp | 17 ++++++------- src/Shades.cpp | 15 ++++++------ src/Streams.cpp | 12 ++++++---- src/Tides.cpp | 31 ++++++++++++------------ src/Veils.cpp | 21 ++++++++-------- src/Warps.cpp | 15 ++++++------ 16 files changed, 151 insertions(+), 195 deletions(-) diff --git a/Makefile b/Makefile index 11861e2..8ae9ad0 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,10 @@ -ARCH ?= linux -CXXFLAGS = -MMD -fPIC -g -Wall -std=c++11 -O3 -msse -mfpmath=sse -ffast-math -DTEST \ +ARCH ?= lin +FLAGS = -fPIC -g -Wall -O3 -msse -mfpmath=sse -ffast-math \ + -fshort-enums -DTEST \ -I./src -I../../include -I./eurorack \ - -fshort-enums + -Wno-unused-local-typedefs -LDFLAGS = SOURCES = $(wildcard src/*.cpp) \ eurorack/stmlib/utils/random.cc \ @@ -46,30 +46,17 @@ SOURCES = $(wildcard src/*.cpp) \ eurorack/warps/resources.cc -# Linux -ifeq ($(ARCH), linux) -CC = gcc -CXX = g++ -CXXFLAGS += -Wno-unused-local-typedefs +ifeq ($(ARCH), lin) LDFLAGS += -shared TARGET = plugin.so endif -# Apple -ifeq ($(ARCH), apple) -CC = clang -CXX = clang++ -CXXFLAGS += -stdlib=libc++ -LDFLAGS += -stdlib=libc++ -shared -undefined dynamic_lookup +ifeq ($(ARCH), mac) +LDFLAGS += -shared -undefined dynamic_lookup TARGET = plugin.dylib endif -# Windows -ifeq ($(ARCH), windows) -CC = x86_64-w64-mingw32-gcc -CXX = x86_64-w64-mingw32-g++ -CXXFLAGS += -D_USE_MATH_DEFINES -Wno-unused-local-typedefs -SOURCES += +ifeq ($(ARCH), win) LDFLAGS += -shared -L../../ -lRack TARGET = plugin.dll endif diff --git a/src/AudibleInstruments.cpp b/src/AudibleInstruments.cpp index 2f23cb3..6df5685 100644 --- a/src/AudibleInstruments.cpp +++ b/src/AudibleInstruments.cpp @@ -1,31 +1,15 @@ #include "AudibleInstruments.hpp" -void ValueLight::step() { - float v = getf(value); - if (v > 0) { - color = nvgHSL(0.36, 0.7, 0.7); - color.a = v; // May be larger than 1 - } - else if (v < 0) { - color = nvgHSL(0.0, 0.7, 0.7); - color.a = -v; - } - else { - color = nvgRGBAf(1.0, 1.0, 1.0, 0.0); - } -} - - -void ModeLight::step() { - int mode = (int) roundf(getf(value)); - switch (mode) { - case 0: color = nvgHSL(0.36, 0.7, 0.7); break; - case 1: color = nvgHSL(0.18, 0.7, 0.7); break; - case 2: color = nvgHSL(0.0, 0.7, 0.7); break; - default: color = nvgRGBAf(0.0, 0.0, 0.0, 0.0); break; - } -} +// void ModeLight::step() { +// int mode = (int) roundf(getf(value)); +// switch (mode) { +// case 0: color = nvgHSL(0.36, 0.7, 0.7); break; +// case 1: color = nvgHSL(0.18, 0.7, 0.7); break; +// case 2: color = nvgHSL(0.0, 0.7, 0.7); break; +// default: color = nvgRGBAf(0.0, 0.0, 0.0, 0.0); break; +// } +// } struct AudibleInstrumentsPlugin : Plugin { diff --git a/src/AudibleInstruments.hpp b/src/AudibleInstruments.hpp index cef5de6..a3f8dbc 100644 --- a/src/AudibleInstruments.hpp +++ b/src/AudibleInstruments.hpp @@ -165,49 +165,18 @@ struct SlideSwitch : Switch { } }; -//////////////////// -// lights -//////////////////// - -struct ValueLight : virtual Light { - float *value = NULL; - void step(); -}; - -struct ModeLight : ValueLight { - void step(); -}; - -struct SmallLight : virtual Light { - SmallLight() { - box.size = Vec(7, 7); - spriteOffset = Vec(-16, -16); - spriteSize = Vec(38, 38); - spriteImage = Image::load("plugins/AudibleInstruments/res/light_small.png"); - } -}; - -struct MediumLight : virtual Light { - MediumLight() { - box.size = Vec(14, 14); - spriteOffset = Vec(-16, -15); - spriteSize = Vec(45, 45); - spriteImage = Image::load("plugins/AudibleInstruments/res/light_medium.png"); +struct TripleModeLight : ValueLight { + void step() { + float v = roundf(getf(value)); + if (v == 0.0) + color = SCHEME_CYAN; + else if (v == 1.0) + color = SCHEME_ORANGE; + else + color = SCHEME_RED; } }; -struct SmallValueLight : SmallLight, ValueLight {}; -struct MediumValueLight : MediumLight, ValueLight {}; -struct SmallModeLight : SmallLight, ModeLight {}; - -template -ValueLight *createValueLight(Vec pos, float *value) { - ValueLight *light = new TLight(); - light->box.pos = pos; - light->value = value; - return light; -} - //////////////////// // module widgets //////////////////// diff --git a/src/Blinds.cpp b/src/Blinds.cpp index b9c30a0..9d95eb3 100644 --- a/src/Blinds.cpp +++ b/src/Blinds.cpp @@ -84,7 +84,9 @@ void Blinds::step() { } -BlindsWidget::BlindsWidget() : ModuleWidget(new Blinds()) { +BlindsWidget::BlindsWidget() { + Blinds *module = new Blinds(); + setModule(module); box.size = Vec(15*12, 380); { @@ -94,10 +96,10 @@ BlindsWidget::BlindsWidget() : ModuleWidget(new Blinds()) { addChild(panel); } - addChild(createScrew(Vec(15, 0))); - addChild(createScrew(Vec(150, 0))); - addChild(createScrew(Vec(15, 365))); - addChild(createScrew(Vec(150, 365))); + addChild(createScrew(Vec(15, 0))); + addChild(createScrew(Vec(150, 0))); + addChild(createScrew(Vec(15, 365))); + addChild(createScrew(Vec(150, 365))); addParam(createParam(Vec(8, 52), module, Blinds::GAIN1_PARAM, -1.0, 1.0, 0.0)); addParam(createParam(Vec(8, 131), module, Blinds::GAIN2_PARAM, -1.0, 1.0, 0.0)); @@ -124,14 +126,13 @@ BlindsWidget::BlindsWidget() : ModuleWidget(new Blinds()) { addOutput(createOutput(Vec(141, 195), module, Blinds::OUT3_OUTPUT)); addOutput(createOutput(Vec(141, 274), module, Blinds::OUT4_OUTPUT)); - Blinds *blinds = dynamic_cast(module); - addChild(createValueLight(Vec(149, 86), &blinds->lights[0])); - addChild(createValueLight(Vec(149, 165), &blinds->lights[1])); - addChild(createValueLight(Vec(149, 244), &blinds->lights[2])); - addChild(createValueLight(Vec(149, 323), &blinds->lights[3])); + addChild(createValueLight>(Vec(150, 87), &module->lights[0])); + addChild(createValueLight>(Vec(150, 166), &module->lights[1])); + addChild(createValueLight>(Vec(150, 245), &module->lights[2])); + addChild(createValueLight>(Vec(150, 324), &module->lights[3])); - addChild(createValueLight(Vec(78, 97), &blinds->gainLights[0])); - addChild(createValueLight(Vec(78, 176), &blinds->gainLights[1])); - addChild(createValueLight(Vec(78, 255), &blinds->gainLights[2])); - addChild(createValueLight(Vec(78, 334), &blinds->gainLights[3])); + addChild(createValueLight>(Vec(77, 96), &module->gainLights[0])); + addChild(createValueLight>(Vec(77, 175), &module->gainLights[1])); + addChild(createValueLight>(Vec(77, 254), &module->gainLights[2])); + addChild(createValueLight>(Vec(77, 333), &module->gainLights[3])); } diff --git a/src/Braids.cpp b/src/Braids.cpp index 1077986..f83cdf2 100644 --- a/src/Braids.cpp +++ b/src/Braids.cpp @@ -173,14 +173,16 @@ struct BraidsDisplay : TransparentWidget { NVGcolor color = nvgRGB(0xaf, 0xd2, 0x2c); nvgFillColor(vg, nvgTransRGBA(color, 16)); - nvgText(vg, box.pos.x, box.pos.y, "~~~~", NULL); + nvgText(vg, 0.0, 0.0, "~~~~", NULL); nvgFillColor(vg, color); - nvgText(vg, box.pos.x, box.pos.y, algo_values[shape], NULL); + nvgText(vg, 0.0, 0.0, algo_values[shape], NULL); } }; -BraidsWidget::BraidsWidget() : ModuleWidget(new Braids()) { +BraidsWidget::BraidsWidget() { + Braids *module = new Braids(); + setModule(module); box.size = Vec(15*16, 380); { @@ -197,10 +199,10 @@ BraidsWidget::BraidsWidget() : ModuleWidget(new Braids()) { addChild(display); } - addChild(createScrew(Vec(15, 0))); - addChild(createScrew(Vec(210, 0))); - addChild(createScrew(Vec(15, 365))); - addChild(createScrew(Vec(210, 365))); + addChild(createScrew(Vec(15, 0))); + addChild(createScrew(Vec(210, 0))); + addChild(createScrew(Vec(15, 365))); + addChild(createScrew(Vec(210, 365))); addParam(createParam(Vec(187-10, 71-11), module, Braids::SHAPE_PARAM, 0.0, braids::MACRO_OSC_SHAPE_LAST-2, 0.0)); diff --git a/src/Branches.cpp b/src/Branches.cpp index 231beb2..7555b22 100644 --- a/src/Branches.cpp +++ b/src/Branches.cpp @@ -73,7 +73,9 @@ void Branches::step() { } -BranchesWidget::BranchesWidget() : ModuleWidget(new Branches()) { +BranchesWidget::BranchesWidget() { + Branches *module = new Branches(); + setModule(module); box.size = Vec(15*6, 380); { @@ -83,8 +85,8 @@ BranchesWidget::BranchesWidget() : ModuleWidget(new Branches()) { addChild(panel); } - addChild(createScrew(Vec(15, 0))); - addChild(createScrew(Vec(15, 365))); + addChild(createScrew(Vec(15, 0))); + addChild(createScrew(Vec(15, 365))); addParam(createParam(Vec(24, 64), module, Branches::THRESHOLD1_PARAM, 0.0, 1.0, 0.5)); addParam(createParam(Vec(69, 58), module, Branches::MODE1_PARAM, 0.0, 1.0, 0.0)); @@ -100,7 +102,6 @@ BranchesWidget::BranchesWidget() : ModuleWidget(new Branches()) { addOutput(createOutput(Vec(5, 313), module, Branches::OUT2A_OUTPUT)); addOutput(createOutput(Vec(52, 313), module, Branches::OUT2B_OUTPUT)); - Branches *branches = dynamic_cast(module); - addChild(createValueLight(Vec(42, 170), &branches->light[0])); - addChild(createValueLight(Vec(42, 326), &branches->light[1])); + addChild(createValueLight>(Vec(40, 169), &module->light[0])); + addChild(createValueLight>(Vec(40, 325), &module->light[1])); } diff --git a/src/Clouds.cpp b/src/Clouds.cpp index fa3bc32..af9880f 100644 --- a/src/Clouds.cpp +++ b/src/Clouds.cpp @@ -156,7 +156,9 @@ void Clouds::step() { } -CloudsWidget::CloudsWidget() : ModuleWidget(new Clouds()) { +CloudsWidget::CloudsWidget() { + Clouds *module = new Clouds(); + setModule(module); box.size = Vec(15*18, 380); { @@ -166,10 +168,10 @@ CloudsWidget::CloudsWidget() : ModuleWidget(new Clouds()) { addChild(panel); } - addChild(createScrew(Vec(15, 0))); - addChild(createScrew(Vec(240, 0))); - addChild(createScrew(Vec(15, 365))); - addChild(createScrew(Vec(240, 365))); + addChild(createScrew(Vec(15, 0))); + addChild(createScrew(Vec(240, 0))); + addChild(createScrew(Vec(15, 365))); + addChild(createScrew(Vec(240, 365))); // TODO // addParam(createParam(Vec(211, 51), module, Clouds::POSITION_PARAM, 0.0, 1.0, 0.5)); diff --git a/src/Elements.cpp b/src/Elements.cpp index 8c1eec1..d1bd9ce 100644 --- a/src/Elements.cpp +++ b/src/Elements.cpp @@ -189,7 +189,9 @@ void Elements::step() { } -ElementsWidget::ElementsWidget() : ModuleWidget(new Elements()) { +ElementsWidget::ElementsWidget() { + Elements *module = new Elements(); + setModule(module); box.size = Vec(15*34, 380); { @@ -199,10 +201,10 @@ ElementsWidget::ElementsWidget() : ModuleWidget(new Elements()) { addChild(panel); } - addChild(createScrew(Vec(15, 0))); - addChild(createScrew(Vec(480, 0))); - addChild(createScrew(Vec(15, 365))); - addChild(createScrew(Vec(480, 365))); + addChild(createScrew(Vec(15, 0))); + addChild(createScrew(Vec(480, 0))); + addChild(createScrew(Vec(15, 365))); + addChild(createScrew(Vec(480, 365))); addParam(createParam(Vec(29, 43), module, Elements::CONTOUR_PARAM, 0.0, 1.0, 0.5)); addParam(createParam(Vec(100, 43), module, Elements::BOW_PARAM, 0.0, 1.0, 0.5)); @@ -260,7 +262,6 @@ ElementsWidget::ElementsWidget() : ModuleWidget(new Elements()) { addParam(createParam(Vec(36, 116), module, Elements::PLAY_PARAM, 0.0, 2.0, 0.0)); - Elements *elements = dynamic_cast(module); - addChild(createValueLight(Vec(184, 168), &elements->lights[0])); - addChild(createValueLight(Vec(395, 168), &elements->lights[1])); + addChild(createValueLight>(Vec(184, 165), &module->lights[0])); + addChild(createValueLight>(Vec(395, 165), &module->lights[1])); } diff --git a/src/Kinks.cpp b/src/Kinks.cpp index 3b0d49b..5d9fd7a 100644 --- a/src/Kinks.cpp +++ b/src/Kinks.cpp @@ -85,7 +85,9 @@ void Kinks::step() { } -KinksWidget::KinksWidget() : ModuleWidget(new Kinks()) { +KinksWidget::KinksWidget() { + Kinks *module = new Kinks(); + setModule(module); box.size = Vec(15*4, 380); { @@ -95,8 +97,8 @@ KinksWidget::KinksWidget() : ModuleWidget(new Kinks()) { addChild(panel); } - addChild(createScrew(Vec(15, 0))); - addChild(createScrew(Vec(15, 365))); + addChild(createScrew(Vec(15, 0))); + addChild(createScrew(Vec(15, 365))); addInput(createInput(Vec(0, 72), module, Kinks::SIGN_INPUT)); addOutput(createOutput(Vec(29, 72), module, Kinks::INVERT_OUTPUT)); @@ -113,8 +115,7 @@ KinksWidget::KinksWidget() : ModuleWidget(new Kinks()) { addOutput(createOutput(Vec(0, 313), module, Kinks::NOISE_OUTPUT)); addOutput(createOutput(Vec(29, 313), module, Kinks::SH_OUTPUT)); - Kinks *kinks = dynamic_cast(module); - addChild(createValueLight(Vec(12, 61), &kinks->lights[0])); - addChild(createValueLight(Vec(12, 164), &kinks->lights[1])); - addChild(createValueLight(Vec(12, 264), &kinks->lights[2])); + addChild(createValueLight>(Vec(11, 59), &module->lights[0])); + addChild(createValueLight>(Vec(11, 161), &module->lights[1])); + addChild(createValueLight>(Vec(11, 262), &module->lights[2])); } diff --git a/src/Links.cpp b/src/Links.cpp index ef9521a..cf8e363 100644 --- a/src/Links.cpp +++ b/src/Links.cpp @@ -48,13 +48,15 @@ void Links::step() { setf(outputs[B2_OUTPUT], in2); setf(outputs[C1_OUTPUT], in3); - lights[0] = in1; - lights[1] = in2; - lights[2] = in3; + lights[0] = in1 / 5.0; + lights[1] = in2 / 5.0; + lights[2] = in3 / 5.0; } -LinksWidget::LinksWidget() : ModuleWidget(new Links()) { +LinksWidget::LinksWidget() { + Links *module = new Links(); + setModule(module); box.size = Vec(15*4, 380); { @@ -64,8 +66,8 @@ LinksWidget::LinksWidget() : ModuleWidget(new Links()) { addChild(panel); } - addChild(createScrew(Vec(15, 0))); - addChild(createScrew(Vec(15, 365))); + addChild(createScrew(Vec(15, 0))); + addChild(createScrew(Vec(15, 365))); addInput(createInput(Vec(0, 72), module, Links::A1_INPUT)); addOutput(createOutput(Vec(29, 72), module, Links::A1_OUTPUT)); @@ -82,8 +84,7 @@ LinksWidget::LinksWidget() : ModuleWidget(new Links()) { addInput(createInput(Vec(0, 313), module, Links::C3_INPUT)); addOutput(createOutput(Vec(29, 313), module, Links::C1_OUTPUT)); - Links *links = dynamic_cast(module); - addChild(createValueLight(Vec(26, 61), &links->lights[0])); - addChild(createValueLight(Vec(26, 164), &links->lights[1])); - addChild(createValueLight(Vec(26, 264), &links->lights[2])); + addChild(createValueLight>(Vec(26, 59), &module->lights[0])); + addChild(createValueLight>(Vec(26, 161), &module->lights[1])); + addChild(createValueLight>(Vec(26, 262), &module->lights[2])); } diff --git a/src/Rings.cpp b/src/Rings.cpp index bf1eb51..e31b0ed 100644 --- a/src/Rings.cpp +++ b/src/Rings.cpp @@ -196,7 +196,9 @@ void Rings::step() { } -RingsWidget::RingsWidget() : ModuleWidget(new Rings()) { +RingsWidget::RingsWidget() { + Rings *module = new Rings(); + setModule(module); box.size = Vec(15*14, 380); { @@ -206,10 +208,10 @@ RingsWidget::RingsWidget() : ModuleWidget(new Rings()) { addChild(panel); } - addChild(createScrew(Vec(15, 0))); - addChild(createScrew(Vec(180, 0))); - addChild(createScrew(Vec(15, 365))); - addChild(createScrew(Vec(180, 365))); + addChild(createScrew(Vec(15, 0))); + addChild(createScrew(Vec(180, 0))); + addChild(createScrew(Vec(15, 365))); + addChild(createScrew(Vec(180, 365))); addParam(createParam(Vec(14, 40), module, Rings::POLYPHONY_PARAM, 0.0, 2.0, 0.0)); addParam(createParam(Vec(179, 40), module, Rings::RESONATOR_PARAM, 0.0, 2.0, 0.0)); @@ -239,7 +241,6 @@ RingsWidget::RingsWidget() : ModuleWidget(new Rings()) { addOutput(createOutput(Vec(128, 313), module, Rings::ODD_OUTPUT)); addOutput(createOutput(Vec(166, 313), module, Rings::EVEN_OUTPUT)); - Rings *rings = dynamic_cast(module); - addChild(createValueLight(Vec(39, 45), &rings->params[Rings::POLYPHONY_PARAM])); - addChild(createValueLight(Vec(164, 45), &rings->params[Rings::RESONATOR_PARAM])); + addChild(createValueLight>(Vec(38, 44), &module->params[Rings::POLYPHONY_PARAM])); + addChild(createValueLight>(Vec(163, 44), &module->params[Rings::RESONATOR_PARAM])); } diff --git a/src/Shades.cpp b/src/Shades.cpp index 81753ca..67d3b51 100644 --- a/src/Shades.cpp +++ b/src/Shades.cpp @@ -75,7 +75,9 @@ void Shades::step() { } -ShadesWidget::ShadesWidget() : ModuleWidget(new Shades()) { +ShadesWidget::ShadesWidget() { + Shades *module = new Shades(); + setModule(module); box.size = Vec(15*6, 380); { @@ -85,8 +87,8 @@ ShadesWidget::ShadesWidget() : ModuleWidget(new Shades()) { addChild(panel); } - addChild(createScrew(Vec(15, 0))); - addChild(createScrew(Vec(15, 365))); + addChild(createScrew(Vec(15, 0))); + addChild(createScrew(Vec(15, 365))); addParam(createParam(Vec(40, 41), module, Shades::GAIN1_PARAM, 0.0, 1.0, 0.5)); addParam(createParam(Vec(40, 107), module, Shades::GAIN2_PARAM, 0.0, 1.0, 0.5)); @@ -104,8 +106,7 @@ ShadesWidget::ShadesWidget() : ModuleWidget(new Shades()) { addOutput(createOutput(Vec(52, 278), module, Shades::OUT2_OUTPUT)); addOutput(createOutput(Vec(52, 314), module, Shades::OUT3_OUTPUT)); - Shades *shades = dynamic_cast(module); - addChild(createValueLight(Vec(42, 256), &shades->lights[0])); - addChild(createValueLight(Vec(42, 292), &shades->lights[1])); - addChild(createValueLight(Vec(42, 328), &shades->lights[2])); + addChild(createValueLight>(Vec(41, 254), &module->lights[0])); + addChild(createValueLight>(Vec(41, 290), &module->lights[1])); + addChild(createValueLight>(Vec(41, 326), &module->lights[2])); } diff --git a/src/Streams.cpp b/src/Streams.cpp index 0ed69c8..df311eb 100644 --- a/src/Streams.cpp +++ b/src/Streams.cpp @@ -46,7 +46,9 @@ void Streams::step() { } -StreamsWidget::StreamsWidget() : ModuleWidget(new Streams()) { +StreamsWidget::StreamsWidget() { + Streams *module = new Streams(); + setModule(module); box.size = Vec(15*12, 380); { @@ -56,10 +58,10 @@ StreamsWidget::StreamsWidget() : ModuleWidget(new Streams()) { addChild(panel); } - addChild(createScrew(Vec(15, 0))); - addChild(createScrew(Vec(150, 0))); - addChild(createScrew(Vec(15, 365))); - addChild(createScrew(Vec(150, 365))); + addChild(createScrew(Vec(15, 0))); + addChild(createScrew(Vec(150, 0))); + addChild(createScrew(Vec(15, 365))); + addChild(createScrew(Vec(150, 365))); // addParam(createParam(Vec(30, 53), module, Streams::ALGORITHM_PARAM, 0.0, 8.0, 0.0)); diff --git a/src/Tides.cpp b/src/Tides.cpp index 589edfc..45c00b7 100644 --- a/src/Tides.cpp +++ b/src/Tides.cpp @@ -137,11 +137,13 @@ void Tides::step() { setf(outputs[UNI_OUTPUT], unif); setf(outputs[BI_OUTPUT], bif); - lights[1] = sample.flags & tides::FLAG_END_OF_ATTACK ? -unif : unif; + lights[1] = (sample.flags & tides::FLAG_END_OF_ATTACK ? -unif : unif) / 8.0; } -TidesWidget::TidesWidget() : ModuleWidget(new Tides()) { +TidesWidget::TidesWidget() { + Tides *module = new Tides(); + setModule(module); box.size = Vec(15*14, 380); { @@ -151,10 +153,10 @@ TidesWidget::TidesWidget() : ModuleWidget(new Tides()) { addChild(panel); } - addChild(createScrew(Vec(15, 0))); - addChild(createScrew(Vec(180, 0))); - addChild(createScrew(Vec(15, 365))); - addChild(createScrew(Vec(180, 365))); + addChild(createScrew(Vec(15, 0))); + addChild(createScrew(Vec(180, 0))); + addChild(createScrew(Vec(15, 365))); + addChild(createScrew(Vec(180, 365))); addParam(createParam(Vec(19, 52), module, Tides::MODE_PARAM, -1.0, 1.0, 0.0)); addParam(createParam(Vec(19, 93), module, Tides::RANGE_PARAM, -1.0, 1.0, 0.0)); @@ -170,11 +172,11 @@ TidesWidget::TidesWidget() : ModuleWidget(new Tides()) { addInput(createInput(Vec(90, 216), module, Tides::SLOPE_INPUT)); addInput(createInput(Vec(161, 216), module, Tides::SMOOTHNESS_INPUT)); - addInput(createInput(Vec(18, 270), module, Tides::TRIG_INPUT)); - addInput(createInput(Vec(54, 270), module, Tides::FREEZE_INPUT)); - addInput(createInput(Vec(90, 270), module, Tides::PITCH_INPUT)); - addInput(createInput(Vec(125, 270), module, Tides::FM_INPUT)); - addInput(createInput(Vec(161, 270), module, Tides::LEVEL_INPUT)); + addInput(createInput(Vec(18, 271), module, Tides::TRIG_INPUT)); + addInput(createInput(Vec(54, 271), module, Tides::FREEZE_INPUT)); + addInput(createInput(Vec(90, 271), module, Tides::PITCH_INPUT)); + addInput(createInput(Vec(125, 271), module, Tides::FM_INPUT)); + addInput(createInput(Vec(161, 271), module, Tides::LEVEL_INPUT)); addInput(createInput(Vec(18, 313), module, Tides::CLOCK_INPUT)); addOutput(createOutput(Vec(54, 313), module, Tides::HIGH_OUTPUT)); @@ -182,8 +184,7 @@ TidesWidget::TidesWidget() : ModuleWidget(new Tides()) { addOutput(createOutput(Vec(125, 313), module, Tides::UNI_OUTPUT)); addOutput(createOutput(Vec(161, 313), module, Tides::BI_OUTPUT)); - Tides *tides = dynamic_cast(module); - addChild(createValueLight(Vec(58, 63), &tides->lights[0])); - addChild(createValueLight(Vec(58, 84), &tides->lights[1])); - addChild(createValueLight(Vec(58, 105), &tides->lights[2])); + addChild(createValueLight>(Vec(57, 62), &module->lights[0])); + addChild(createValueLight>(Vec(57, 83), &module->lights[1])); + addChild(createValueLight>(Vec(57, 103), &module->lights[2])); } diff --git a/src/Veils.cpp b/src/Veils.cpp index e21e59a..0bda897 100644 --- a/src/Veils.cpp +++ b/src/Veils.cpp @@ -93,7 +93,9 @@ void Veils::step() { } -VeilsWidget::VeilsWidget() : ModuleWidget(new Veils()) { +VeilsWidget::VeilsWidget() { + Veils *module = new Veils(); + setModule(module); box.size = Vec(15*12, 380); { @@ -103,10 +105,10 @@ VeilsWidget::VeilsWidget() : ModuleWidget(new Veils()) { addChild(panel); } - addChild(createScrew(Vec(15, 0))); - addChild(createScrew(Vec(150, 0))); - addChild(createScrew(Vec(15, 365))); - addChild(createScrew(Vec(150, 365))); + addChild(createScrew(Vec(15, 0))); + addChild(createScrew(Vec(150, 0))); + addChild(createScrew(Vec(15, 365))); + addChild(createScrew(Vec(150, 365))); addParam(createParam(Vec(8, 52), module, Veils::GAIN1_PARAM, 0.0, 1.0, 0.0)); addParam(createParam(Vec(8, 131), module, Veils::GAIN2_PARAM, 0.0, 1.0, 0.0)); @@ -133,9 +135,8 @@ VeilsWidget::VeilsWidget() : ModuleWidget(new Veils()) { addOutput(createOutput(Vec(141, 195), module, Veils::OUT3_OUTPUT)); addOutput(createOutput(Vec(141, 274), module, Veils::OUT4_OUTPUT)); - Veils *veils = dynamic_cast(module); - addChild(createValueLight(Vec(149, 86), &veils->lights[0])); - addChild(createValueLight(Vec(149, 165), &veils->lights[1])); - addChild(createValueLight(Vec(149, 244), &veils->lights[2])); - addChild(createValueLight(Vec(149, 323), &veils->lights[3])); + addChild(createValueLight>(Vec(150, 87), &module->lights[0])); + addChild(createValueLight>(Vec(150, 166), &module->lights[1])); + addChild(createValueLight>(Vec(150, 245), &module->lights[2])); + addChild(createValueLight>(Vec(150, 324), &module->lights[3])); } diff --git a/src/Warps.cpp b/src/Warps.cpp index 422f3bf..0d10f33 100644 --- a/src/Warps.cpp +++ b/src/Warps.cpp @@ -76,7 +76,9 @@ void Warps::step() { } -WarpsWidget::WarpsWidget() : ModuleWidget(new Warps()) { +WarpsWidget::WarpsWidget() { + Warps *module = new Warps(); + setModule(module); box.size = Vec(15*10, 380); { @@ -86,10 +88,10 @@ WarpsWidget::WarpsWidget() : ModuleWidget(new Warps()) { addChild(panel); } - addChild(createScrew(Vec(15, 0))); - addChild(createScrew(Vec(120, 0))); - addChild(createScrew(Vec(15, 365))); - addChild(createScrew(Vec(120, 365))); + addChild(createScrew(Vec(15, 0))); + addChild(createScrew(Vec(120, 0))); + addChild(createScrew(Vec(15, 365))); + addChild(createScrew(Vec(120, 365))); addParam(createParam(Vec(30, 53), module, Warps::ALGORITHM_PARAM, 0.0, 8.0, 0.0)); @@ -108,6 +110,5 @@ WarpsWidget::WarpsWidget() : ModuleWidget(new Warps()) { addOutput(createOutput(Vec(77, 313), module, Warps::MODULATOR_OUTPUT)); addOutput(createOutput(Vec(113, 313), module, Warps::AUX_OUTPUT)); - Warps *warps = dynamic_cast(module); - addChild(createValueLight(Vec(21, 168), &warps->lights[0])); + addChild(createValueLight>(Vec(20, 167), &module->lights[0])); }