diff --git a/src/AudibleInstruments.cpp b/src/AudibleInstruments.cpp index c958c7e..21ba157 100644 --- a/src/AudibleInstruments.cpp +++ b/src/AudibleInstruments.cpp @@ -8,17 +8,31 @@ void init(rack::Plugin *p) { p->slug = TOSTRING(SLUG); p->version = TOSTRING(VERSION); - p->addModel(createModel("Audible Instruments", "Braids", "Macro Oscillator", OSCILLATOR_TAG, WAVESHAPER_TAG)); - p->addModel(createModel("Audible Instruments", "Elements", "Modal Synthesizer", PHYSICAL_MODELING_TAG)); - p->addModel(createModel("Audible Instruments", "Tides", "Tidal Modulator", LFO_TAG, OSCILLATOR_TAG, WAVESHAPER_TAG, FUNCTION_GENERATOR_TAG)); - p->addModel(createModel("Audible Instruments", "Clouds", "Texture Synthesizer", GRANULAR_TAG, REVERB_TAG)); - p->addModel(createModel("Audible Instruments", "Warps", "Meta Modulator", RING_MODULATOR_TAG, WAVESHAPER_TAG)); - p->addModel(createModel("Audible Instruments", "Rings", "Resonator", PHYSICAL_MODELING_TAG)); - p->addModel(createModel("Audible Instruments", "Links", "Multiples", MULTIPLE_TAG, MIXER_TAG)); - p->addModel(createModel("Audible Instruments", "Kinks", "Utilities", UTILITY_TAG, NOISE_TAG)); - p->addModel(createModel("Audible Instruments", "Shades", "Mixer", MIXER_TAG)); - p->addModel(createModel("Audible Instruments", "Branches", "Bernoulli Gate", RANDOM_TAG, DUAL_TAG)); - p->addModel(createModel("Audible Instruments", "Blinds", "Quad VC-polarizer", MIXER_TAG, ATTENUATOR_TAG)); - p->addModel(createModel("Audible Instruments", "Veils", "Quad VCA", MIXER_TAG)); - p->addModel(createModel("Audible Instruments", "Frames", "Keyframer/Mixer", MIXER_TAG, ATTENUATOR_TAG, LFO_TAG)); + // p->addModel(createModel("Audible Instruments", "Braids", "Macro Oscillator", OSCILLATOR_TAG, WAVESHAPER_TAG)); + // p->addModel(createModel("Audible Instruments", "Elements", "Modal Synthesizer", PHYSICAL_MODELING_TAG)); + // p->addModel(createModel("Audible Instruments", "Tides", "Tidal Modulator", LFO_TAG, OSCILLATOR_TAG, WAVESHAPER_TAG, FUNCTION_GENERATOR_TAG)); + // p->addModel(createModel("Audible Instruments", "Clouds", "Texture Synthesizer", GRANULAR_TAG, REVERB_TAG)); + // p->addModel(createModel("Audible Instruments", "Warps", "Meta Modulator", RING_MODULATOR_TAG, WAVESHAPER_TAG)); + // p->addModel(createModel("Audible Instruments", "Rings", "Resonator", PHYSICAL_MODELING_TAG)); + // p->addModel(createModel("Audible Instruments", "Links", "Multiples", MULTIPLE_TAG, MIXER_TAG)); + // p->addModel(createModel("Audible Instruments", "Kinks", "Utilities", UTILITY_TAG, NOISE_TAG)); + // p->addModel(createModel("Audible Instruments", "Shades", "Mixer", MIXER_TAG)); + // p->addModel(createModel("Audible Instruments", "Branches", "Bernoulli Gate", RANDOM_TAG, DUAL_TAG)); + // p->addModel(createModel("Audible Instruments", "Blinds", "Quad VC-polarizer", MIXER_TAG, ATTENUATOR_TAG)); + // p->addModel(createModel("Audible Instruments", "Veils", "Quad VCA", MIXER_TAG)); + // p->addModel(createModel("Audible Instruments", "Frames", "Keyframer/Mixer", MIXER_TAG, ATTENUATOR_TAG, LFO_TAG)); + + p->addModel(modelBraidsWidget); + p->addModel(modelElementsWidget); + p->addModel(modelTidesWidget); + p->addModel(modelCloudsWidget); + p->addModel(modelWarpsWidget); + p->addModel(modelRingsWidget); + p->addModel(modelLinksWidget); + p->addModel(modelKinksWidget); + p->addModel(modelShadesWidget); + p->addModel(modelBranchesWidget); + p->addModel(modelBlindsWidget); + p->addModel(modelVeilsWidget); + p->addModel(modelFramesWidget); } diff --git a/src/AudibleInstruments.hpp b/src/AudibleInstruments.hpp index 1f1b40a..d096915 100644 --- a/src/AudibleInstruments.hpp +++ b/src/AudibleInstruments.hpp @@ -6,77 +6,16 @@ using namespace rack; extern Plugin *plugin; -//////////////////// -// module widgets -//////////////////// - -struct BraidsWidget : ModuleWidget { - BraidsWidget(); - Menu *createContextMenu() override; -}; - -struct ElementsWidget : ModuleWidget { - ElementsWidget(); - Menu *createContextMenu() override; -}; - -struct TidesWidget : ModuleWidget { - Panel *tidesPanel; - Panel *sheepPanel; - TidesWidget(); - void step() override; - Menu *createContextMenu() override; -}; - -struct StreamsWidget : ModuleWidget { - StreamsWidget(); -}; - -struct CloudsWidget : ModuleWidget { - ParamWidget *blendParam; - ParamWidget *spreadParam; - ParamWidget *feedbackParam; - ParamWidget *reverbParam; - CloudsWidget(); - void step() override; - Menu *createContextMenu() override; -}; - -struct WarpsWidget : ModuleWidget { - WarpsWidget(); -}; - -struct RingsWidget : ModuleWidget { - RingsWidget(); - Menu *createContextMenu() override; -}; - -struct LinksWidget : ModuleWidget { - LinksWidget(); -}; - -struct KinksWidget : ModuleWidget { - KinksWidget(); -}; - -struct ShadesWidget : ModuleWidget { - ShadesWidget(); -}; - -struct BranchesWidget : ModuleWidget { - BranchesWidget(); - Menu *createContextMenu() override; -}; - -struct BlindsWidget : ModuleWidget { - BlindsWidget(); -}; - -struct VeilsWidget : ModuleWidget { - VeilsWidget(); -}; - -struct FramesWidget : ModuleWidget { - FramesWidget(); - Menu *createContextMenu() override; -}; +extern Model *modelBraidsWidget; +extern Model *modelElementsWidget; +extern Model *modelTidesWidget; +extern Model *modelCloudsWidget; +extern Model *modelWarpsWidget; +extern Model *modelRingsWidget; +extern Model *modelLinksWidget; +extern Model *modelKinksWidget; +extern Model *modelShadesWidget; +extern Model *modelBranchesWidget; +extern Model *modelBlindsWidget; +extern Model *modelVeilsWidget; +extern Model *modelFramesWidget; \ No newline at end of file diff --git a/src/Blinds.cpp b/src/Blinds.cpp index 89b16e8..881dc12 100644 --- a/src/Blinds.cpp +++ b/src/Blinds.cpp @@ -69,55 +69,48 @@ void Blinds::step() { } -BlindsWidget::BlindsWidget() { - Blinds *module = new Blinds(); - setModule(module); - box.size = Vec(15*12, 380); - - { - Panel *panel = new LightPanel(); - panel->backgroundImage = Image::load(assetPlugin(plugin, "res/Blinds.png")); - panel->box.size = box.size; - addChild(panel); +struct BlindsWidget : ModuleWidget { + BlindsWidget(Blinds *module) : ModuleWidget(module) { + setPanel(SVG::load(assetPlugin(plugin, "res/Blinds.svg"))); + + addChild(Widget::create(Vec(15, 0))); + addChild(Widget::create(Vec(150, 0))); + addChild(Widget::create(Vec(15, 365))); + addChild(Widget::create(Vec(150, 365))); + + addParam(ParamWidget::create(Vec(8, 52), module, Blinds::GAIN1_PARAM, -1.0, 1.0, 0.0)); + addParam(ParamWidget::create(Vec(8, 131), module, Blinds::GAIN2_PARAM, -1.0, 1.0, 0.0)); + addParam(ParamWidget::create(Vec(8, 210), module, Blinds::GAIN3_PARAM, -1.0, 1.0, 0.0)); + addParam(ParamWidget::create(Vec(8, 288), module, Blinds::GAIN4_PARAM, -1.0, 1.0, 0.0)); + + addParam(ParamWidget::create(Vec(72, 63), module, Blinds::MOD1_PARAM, -1.0, 1.0, 0.0)); + addParam(ParamWidget::create(Vec(72, 142), module, Blinds::MOD2_PARAM, -1.0, 1.0, 0.0)); + addParam(ParamWidget::create(Vec(72, 221), module, Blinds::MOD3_PARAM, -1.0, 1.0, 0.0)); + addParam(ParamWidget::create(Vec(72, 300), module, Blinds::MOD4_PARAM, -1.0, 1.0, 0.0)); + + addInput(Port::create(Vec(110, 41), Port::INPUT, module, Blinds::IN1_INPUT)); + addInput(Port::create(Vec(110, 120), Port::INPUT, module, Blinds::IN2_INPUT)); + addInput(Port::create(Vec(110, 198), Port::INPUT, module, Blinds::IN3_INPUT)); + addInput(Port::create(Vec(110, 277), Port::INPUT, module, Blinds::IN4_INPUT)); + + addInput(Port::create(Vec(110, 80), Port::INPUT, module, Blinds::CV1_INPUT)); + addInput(Port::create(Vec(110, 159), Port::INPUT, module, Blinds::CV2_INPUT)); + addInput(Port::create(Vec(110, 238), Port::INPUT, module, Blinds::CV3_INPUT)); + addInput(Port::create(Vec(110, 316), Port::INPUT, module, Blinds::CV4_INPUT)); + + addOutput(Port::create(Vec(144, 41), Port::OUTPUT, module, Blinds::OUT1_OUTPUT)); + addOutput(Port::create(Vec(144, 120), Port::OUTPUT, module, Blinds::OUT2_OUTPUT)); + addOutput(Port::create(Vec(144, 198), Port::OUTPUT, module, Blinds::OUT3_OUTPUT)); + addOutput(Port::create(Vec(144, 277), Port::OUTPUT, module, Blinds::OUT4_OUTPUT)); + + addChild(ModuleLightWidget::create>(Vec(77, 96), module, Blinds::CV1_POS_LIGHT)); + addChild(ModuleLightWidget::create>(Vec(77, 175), module, Blinds::CV2_POS_LIGHT)); + addChild(ModuleLightWidget::create>(Vec(77, 254), module, Blinds::CV3_POS_LIGHT)); + addChild(ModuleLightWidget::create>(Vec(77, 333), module, Blinds::CV4_POS_LIGHT)); + + addChild(ModuleLightWidget::create>(Vec(150, 87), module, Blinds::OUT1_POS_LIGHT)); + addChild(ModuleLightWidget::create>(Vec(150, 166), module, Blinds::OUT2_POS_LIGHT)); + addChild(ModuleLightWidget::create>(Vec(150, 245), module, Blinds::OUT3_POS_LIGHT)); + addChild(ModuleLightWidget::create>(Vec(150, 324), module, Blinds::OUT4_POS_LIGHT)); } - - addChild(Widget::create(Vec(15, 0))); - addChild(Widget::create(Vec(150, 0))); - addChild(Widget::create(Vec(15, 365))); - addChild(Widget::create(Vec(150, 365))); - - addParam(ParamWidget::create(Vec(8, 52), module, Blinds::GAIN1_PARAM, -1.0, 1.0, 0.0)); - addParam(ParamWidget::create(Vec(8, 131), module, Blinds::GAIN2_PARAM, -1.0, 1.0, 0.0)); - addParam(ParamWidget::create(Vec(8, 210), module, Blinds::GAIN3_PARAM, -1.0, 1.0, 0.0)); - addParam(ParamWidget::create(Vec(8, 288), module, Blinds::GAIN4_PARAM, -1.0, 1.0, 0.0)); - - addParam(ParamWidget::create(Vec(72, 63), module, Blinds::MOD1_PARAM, -1.0, 1.0, 0.0)); - addParam(ParamWidget::create(Vec(72, 142), module, Blinds::MOD2_PARAM, -1.0, 1.0, 0.0)); - addParam(ParamWidget::create(Vec(72, 221), module, Blinds::MOD3_PARAM, -1.0, 1.0, 0.0)); - addParam(ParamWidget::create(Vec(72, 300), module, Blinds::MOD4_PARAM, -1.0, 1.0, 0.0)); - - addInput(Port::create(Vec(110, 41), Port::INPUT, module, Blinds::IN1_INPUT)); - addInput(Port::create(Vec(110, 120), Port::INPUT, module, Blinds::IN2_INPUT)); - addInput(Port::create(Vec(110, 198), Port::INPUT, module, Blinds::IN3_INPUT)); - addInput(Port::create(Vec(110, 277), Port::INPUT, module, Blinds::IN4_INPUT)); - - addInput(Port::create(Vec(110, 80), Port::INPUT, module, Blinds::CV1_INPUT)); - addInput(Port::create(Vec(110, 159), Port::INPUT, module, Blinds::CV2_INPUT)); - addInput(Port::create(Vec(110, 238), Port::INPUT, module, Blinds::CV3_INPUT)); - addInput(Port::create(Vec(110, 316), Port::INPUT, module, Blinds::CV4_INPUT)); - - addOutput(Port::create(Vec(144, 41), Port::OUTPUT, module, Blinds::OUT1_OUTPUT)); - addOutput(Port::create(Vec(144, 120), Port::OUTPUT, module, Blinds::OUT2_OUTPUT)); - addOutput(Port::create(Vec(144, 198), Port::OUTPUT, module, Blinds::OUT3_OUTPUT)); - addOutput(Port::create(Vec(144, 277), Port::OUTPUT, module, Blinds::OUT4_OUTPUT)); - - addChild(ModuleLightWidget::create>(Vec(77, 96), module, Blinds::CV1_POS_LIGHT)); - addChild(ModuleLightWidget::create>(Vec(77, 175), module, Blinds::CV2_POS_LIGHT)); - addChild(ModuleLightWidget::create>(Vec(77, 254), module, Blinds::CV3_POS_LIGHT)); - addChild(ModuleLightWidget::create>(Vec(77, 333), module, Blinds::CV4_POS_LIGHT)); - - addChild(ModuleLightWidget::create>(Vec(150, 87), module, Blinds::OUT1_POS_LIGHT)); - addChild(ModuleLightWidget::create>(Vec(150, 166), module, Blinds::OUT2_POS_LIGHT)); - addChild(ModuleLightWidget::create>(Vec(150, 245), module, Blinds::OUT3_POS_LIGHT)); - addChild(ModuleLightWidget::create>(Vec(150, 324), module, Blinds::OUT4_POS_LIGHT)); -} +}; \ No newline at end of file diff --git a/src/Braids.cpp b/src/Braids.cpp index 833bc2f..9aa605b 100644 --- a/src/Braids.cpp +++ b/src/Braids.cpp @@ -267,49 +267,6 @@ struct BraidsDisplay : TransparentWidget { }; -BraidsWidget::BraidsWidget() { - Braids *module = new Braids(); - setModule(module); - box.size = Vec(15*16, 380); - - { - Panel *panel = new LightPanel(); - panel->backgroundImage = Image::load(assetPlugin(plugin, "res/Braids.png")); - panel->box.size = box.size; - addChild(panel); - } - - { - BraidsDisplay *display = new BraidsDisplay(); - display->box.pos = Vec(14, 53); - display->box.size = Vec(148, 56); - display->module = module; - addChild(display); - } - - addChild(Widget::create(Vec(15, 0))); - addChild(Widget::create(Vec(210, 0))); - addChild(Widget::create(Vec(15, 365))); - addChild(Widget::create(Vec(210, 365))); - - addParam(ParamWidget::create(Vec(176, 59), module, Braids::SHAPE_PARAM, 0.0, 1.0, 0.0)); - - addParam(ParamWidget::create(Vec(19, 138), module, Braids::FINE_PARAM, -1.0, 1.0, 0.0)); - addParam(ParamWidget::create(Vec(97, 138), module, Braids::COARSE_PARAM, -2.0, 2.0, 0.0)); - addParam(ParamWidget::create(Vec(176, 138), module, Braids::FM_PARAM, -1.0, 1.0, 0.0)); - - addParam(ParamWidget::create(Vec(19, 217), module, Braids::TIMBRE_PARAM, 0.0, 1.0, 0.5)); - addParam(ParamWidget::create(Vec(97, 217), module, Braids::MODULATION_PARAM, -1.0, 1.0, 0.0)); - addParam(ParamWidget::create(Vec(176, 217), module, Braids::COLOR_PARAM, 0.0, 1.0, 0.5)); - - addInput(Port::create(Vec(10, 316), Port::INPUT, module, Braids::TRIG_INPUT)); - addInput(Port::create(Vec(47, 316), Port::INPUT, module, Braids::PITCH_INPUT)); - addInput(Port::create(Vec(84, 316), Port::INPUT, module, Braids::FM_INPUT)); - addInput(Port::create(Vec(122, 316), Port::INPUT, module, Braids::TIMBRE_INPUT)); - addInput(Port::create(Vec(160, 316), Port::INPUT, module, Braids::COLOR_INPUT)); - addOutput(Port::create(Vec(205, 316), Port::OUTPUT, module, Braids::OUT_OUTPUT)); -} - struct BraidsSettingItem : MenuItem { uint8_t *setting = NULL; uint8_t offValue = 0; @@ -335,18 +292,51 @@ struct BraidsLowCpuItem : MenuItem { } }; -Menu *BraidsWidget::createContextMenu() { - Menu *menu = ModuleWidget::createContextMenu(); - Braids *braids = dynamic_cast(module); - assert(braids); +struct BraidsWidget : ModuleWidget { + BraidsWidget(Braids *module) : ModuleWidget(module) { + setPanel(SVG::load(assetPlugin(plugin, "res/Braids.svg"))); - menu->addChild(construct()); - menu->addChild(construct(&MenuEntry::text, "Options")); - menu->addChild(construct(&MenuEntry::text, "META", &BraidsSettingItem::setting, &braids->settings.meta_modulation)); - menu->addChild(construct(&MenuEntry::text, "DRFT", &BraidsSettingItem::setting, &braids->settings.vco_drift, &BraidsSettingItem::onValue, 4)); - menu->addChild(construct(&MenuEntry::text, "SIGN", &BraidsSettingItem::setting, &braids->settings.signature, &BraidsSettingItem::onValue, 4)); - menu->addChild(construct(&MenuEntry::text, "Low CPU", &BraidsLowCpuItem::braids, braids)); + { + BraidsDisplay *display = new BraidsDisplay(); + display->box.pos = Vec(14, 53); + display->box.size = Vec(148, 56); + display->module = module; + addChild(display); + } - return menu; -} + addChild(Widget::create(Vec(15, 0))); + addChild(Widget::create(Vec(210, 0))); + addChild(Widget::create(Vec(15, 365))); + addChild(Widget::create(Vec(210, 365))); + + addParam(ParamWidget::create(Vec(176, 59), module, Braids::SHAPE_PARAM, 0.0, 1.0, 0.0)); + + addParam(ParamWidget::create(Vec(19, 138), module, Braids::FINE_PARAM, -1.0, 1.0, 0.0)); + addParam(ParamWidget::create(Vec(97, 138), module, Braids::COARSE_PARAM, -2.0, 2.0, 0.0)); + addParam(ParamWidget::create(Vec(176, 138), module, Braids::FM_PARAM, -1.0, 1.0, 0.0)); + + addParam(ParamWidget::create(Vec(19, 217), module, Braids::TIMBRE_PARAM, 0.0, 1.0, 0.5)); + addParam(ParamWidget::create(Vec(97, 217), module, Braids::MODULATION_PARAM, -1.0, 1.0, 0.0)); + addParam(ParamWidget::create(Vec(176, 217), module, Braids::COLOR_PARAM, 0.0, 1.0, 0.5)); + + addInput(Port::create(Vec(10, 316), Port::INPUT, module, Braids::TRIG_INPUT)); + addInput(Port::create(Vec(47, 316), Port::INPUT, module, Braids::PITCH_INPUT)); + addInput(Port::create(Vec(84, 316), Port::INPUT, module, Braids::FM_INPUT)); + addInput(Port::create(Vec(122, 316), Port::INPUT, module, Braids::TIMBRE_INPUT)); + addInput(Port::create(Vec(160, 316), Port::INPUT, module, Braids::COLOR_INPUT)); + addOutput(Port::create(Vec(205, 316), Port::OUTPUT, module, Braids::OUT_OUTPUT)); + } + + void appendContextMenu(Menu *menu) override { + Braids *braids = dynamic_cast(module); + assert(braids); + + menu->addChild(construct()); + menu->addChild(construct(&MenuLabel::text, "Options")); + menu->addChild(construct(&MenuItem::text, "META", &BraidsSettingItem::setting, &braids->settings.meta_modulation)); + menu->addChild(construct(&MenuItem::text, "DRFT", &BraidsSettingItem::setting, &braids->settings.vco_drift, &BraidsSettingItem::onValue, 4)); + menu->addChild(construct(&MenuItem::text, "SIGN", &BraidsSettingItem::setting, &braids->settings.signature, &BraidsSettingItem::onValue, 4)); + menu->addChild(construct(&MenuItem::text, "Low CPU", &BraidsLowCpuItem::braids, braids)); + } +}; \ No newline at end of file diff --git a/src/Branches.cpp b/src/Branches.cpp index 2a154a4..30347b4 100644 --- a/src/Branches.cpp +++ b/src/Branches.cpp @@ -89,64 +89,51 @@ void Branches::step() { } -BranchesWidget::BranchesWidget() { - Branches *module = new Branches(); - setModule(module); - box.size = Vec(15*6, 380); - - { - Panel *panel = new LightPanel(); - panel->backgroundImage = Image::load(assetPlugin(plugin, "res/Branches.png")); - panel->box.size = box.size; - addChild(panel); +struct BranchesWidget : ModuleWidget { + BranchesWidget(Branches *module) : ModuleWidget(module) { + setPanel(SVG::load(assetPlugin(plugin, "res/Branches.svg"))); + + addChild(Widget::create(Vec(15, 0))); + addChild(Widget::create(Vec(15, 365))); + + addParam(ParamWidget::create(Vec(24, 64), module, Branches::THRESHOLD1_PARAM, 0.0, 1.0, 0.5)); + addParam(ParamWidget::create(Vec(69, 58), module, Branches::MODE1_PARAM, 0.0, 1.0, 0.0)); + addInput(Port::create(Vec(9, 122), Port::INPUT, module, Branches::IN1_INPUT)); + addInput(Port::create(Vec(55, 122), Port::INPUT, module, Branches::P1_INPUT)); + addOutput(Port::create(Vec(9, 160), Port::OUTPUT, module, Branches::OUT1A_OUTPUT)); + addOutput(Port::create(Vec(55, 160), Port::OUTPUT, module, Branches::OUT1B_OUTPUT)); + + addParam(ParamWidget::create(Vec(24, 220), module, Branches::THRESHOLD2_PARAM, 0.0, 1.0, 0.5)); + addParam(ParamWidget::create(Vec(69, 214), module, Branches::MODE2_PARAM, 0.0, 1.0, 0.0)); + addInput(Port::create(Vec(9, 278), Port::INPUT, module, Branches::IN2_INPUT)); + addInput(Port::create(Vec(55, 278), Port::INPUT, module, Branches::P2_INPUT)); + addOutput(Port::create(Vec(9, 316), Port::OUTPUT, module, Branches::OUT2A_OUTPUT)); + addOutput(Port::create(Vec(55, 316), Port::OUTPUT, module, Branches::OUT2B_OUTPUT)); + + addChild(ModuleLightWidget::create>(Vec(40, 169), module, Branches::STATE1_POS_LIGHT)); + addChild(ModuleLightWidget::create>(Vec(40, 325), module, Branches::STATE2_POS_LIGHT)); } - addChild(Widget::create(Vec(15, 0))); - addChild(Widget::create(Vec(15, 365))); - - addParam(ParamWidget::create(Vec(24, 64), module, Branches::THRESHOLD1_PARAM, 0.0, 1.0, 0.5)); - addParam(ParamWidget::create(Vec(69, 58), module, Branches::MODE1_PARAM, 0.0, 1.0, 0.0)); - addInput(Port::create(Vec(9, 122), Port::INPUT, module, Branches::IN1_INPUT)); - addInput(Port::create(Vec(55, 122), Port::INPUT, module, Branches::P1_INPUT)); - addOutput(Port::create(Vec(9, 160), Port::OUTPUT, module, Branches::OUT1A_OUTPUT)); - addOutput(Port::create(Vec(55, 160), Port::OUTPUT, module, Branches::OUT1B_OUTPUT)); - - addParam(ParamWidget::create(Vec(24, 220), module, Branches::THRESHOLD2_PARAM, 0.0, 1.0, 0.5)); - addParam(ParamWidget::create(Vec(69, 214), module, Branches::MODE2_PARAM, 0.0, 1.0, 0.0)); - addInput(Port::create(Vec(9, 278), Port::INPUT, module, Branches::IN2_INPUT)); - addInput(Port::create(Vec(55, 278), Port::INPUT, module, Branches::P2_INPUT)); - addOutput(Port::create(Vec(9, 316), Port::OUTPUT, module, Branches::OUT2A_OUTPUT)); - addOutput(Port::create(Vec(55, 316), Port::OUTPUT, module, Branches::OUT2B_OUTPUT)); - - addChild(ModuleLightWidget::create>(Vec(40, 169), module, Branches::STATE1_POS_LIGHT)); - addChild(ModuleLightWidget::create>(Vec(40, 325), module, Branches::STATE2_POS_LIGHT)); -} - - -struct BranchesModeItem : MenuItem { - Branches *branches; - int channel; - void onAction(EventAction &e) override { - branches->mode[channel] ^= 1; - } - void step() override { - rightText = branches->mode[channel] ? "Toggle" : "Latch"; - MenuItem::step(); - } -}; - + void appendContextMenu(Menu *menu) override { + Branches *branches = dynamic_cast(module); + assert(branches); -Menu *BranchesWidget::createContextMenu() { - Menu *menu = ModuleWidget::createContextMenu(); - - Branches *branches = dynamic_cast(module); - assert(branches); - - menu->addChild(construct()); + struct BranchesModeItem : MenuItem { + Branches *branches; + int channel; + void onAction(EventAction &e) override { + branches->mode[channel] ^= 1; + } + void step() override { + rightText = branches->mode[channel] ? "Toggle" : "Latch"; + MenuItem::step(); + } + }; - menu->addChild(construct(&MenuEntry::text, "Channels")); - menu->addChild(construct(&MenuEntry::text, "Channel 1 mode", &BranchesModeItem::branches, branches, &BranchesModeItem::channel, 0)); - menu->addChild(construct(&MenuEntry::text, "Channel 2 mode", &BranchesModeItem::branches, branches, &BranchesModeItem::channel, 1)); + menu->addChild(construct()); - return menu; -} + menu->addChild(construct(&MenuLabel::text, "Channels")); + menu->addChild(construct(&MenuItem::text, "Channel 1 mode", &BranchesModeItem::branches, branches, &BranchesModeItem::channel, 0)); + menu->addChild(construct(&MenuItem::text, "Channel 2 mode", &BranchesModeItem::branches, branches, &BranchesModeItem::channel, 1)); + } +}; \ No newline at end of file diff --git a/src/Clouds.cpp b/src/Clouds.cpp index 275ce07..f22bb4b 100644 --- a/src/Clouds.cpp +++ b/src/Clouds.cpp @@ -255,80 +255,13 @@ void Clouds::step() { } -CloudsWidget::CloudsWidget() { - Clouds *module = new Clouds(); - setModule(module); - box.size = Vec(15*18, 380); - - { - Panel *panel = new LightPanel(); - panel->backgroundImage = Image::load(assetPlugin(plugin, "res/Clouds.png")); - panel->box.size = box.size; - addChild(panel); - } - - addChild(Widget::create(Vec(15, 0))); - addChild(Widget::create(Vec(240, 0))); - addChild(Widget::create(Vec(15, 365))); - addChild(Widget::create(Vec(240, 365))); - - addParam(ParamWidget::create(Vec(27, 93), module, Clouds::POSITION_PARAM, 0.0, 1.0, 0.5)); - addParam(ParamWidget::create(Vec(108, 93), module, Clouds::SIZE_PARAM, 0.0, 1.0, 0.5)); - addParam(ParamWidget::create(Vec(190, 93), module, Clouds::PITCH_PARAM, -2.0, 2.0, 0.0)); - - addParam(ParamWidget::create(Vec(14, 180), module, Clouds::IN_GAIN_PARAM, 0.0, 1.0, 0.5)); - addParam(ParamWidget::create(Vec(81, 180), module, Clouds::DENSITY_PARAM, 0.0, 1.0, 0.5)); - addParam(ParamWidget::create(Vec(146, 180), module, Clouds::TEXTURE_PARAM, 0.0, 1.0, 0.5)); - blendParam = ParamWidget::create(Vec(213, 180), module, Clouds::BLEND_PARAM, 0.0, 1.0, 0.5); - addParam(blendParam); - spreadParam = ParamWidget::create(Vec(213, 180), module, Clouds::SPREAD_PARAM, 0.0, 1.0, 0.0); - addParam(spreadParam); - feedbackParam = ParamWidget::create(Vec(213, 180), module, Clouds::FEEDBACK_PARAM, 0.0, 1.0, 0.0); - addParam(feedbackParam); - reverbParam = ParamWidget::create(Vec(213, 180), module, Clouds::REVERB_PARAM, 0.0, 1.0, 0.0); - addParam(reverbParam); - - addParam(ParamWidget::create(Vec(12, 43), module, Clouds::FREEZE_PARAM, 0.0, 1.0, 0.0)); - addParam(ParamWidget::create(Vec(211, 50), module, Clouds::MODE_PARAM, 0.0, 1.0, 0.0)); - addParam(ParamWidget::create(Vec(239, 50), module, Clouds::LOAD_PARAM, 0.0, 1.0, 0.0)); - - addInput(Port::create(Vec(15, 274), Port::INPUT, module, Clouds::FREEZE_INPUT)); - addInput(Port::create(Vec(58, 274), Port::INPUT, module, Clouds::TRIG_INPUT)); - addInput(Port::create(Vec(101, 274), Port::INPUT, module, Clouds::POSITION_INPUT)); - addInput(Port::create(Vec(144, 274), Port::INPUT, module, Clouds::SIZE_INPUT)); - addInput(Port::create(Vec(188, 274), Port::INPUT, module, Clouds::PITCH_INPUT)); - addInput(Port::create(Vec(230, 274), Port::INPUT, module, Clouds::BLEND_INPUT)); - - addInput(Port::create(Vec(15, 317), Port::INPUT, module, Clouds::IN_L_INPUT)); - addInput(Port::create(Vec(58, 317), Port::INPUT, module, Clouds::IN_R_INPUT)); - addInput(Port::create(Vec(101, 317), Port::INPUT, module, Clouds::DENSITY_INPUT)); - addInput(Port::create(Vec(144, 317), Port::INPUT, module, Clouds::TEXTURE_INPUT)); - addOutput(Port::create(Vec(188, 317), Port::OUTPUT, module, Clouds::OUT_L_OUTPUT)); - addOutput(Port::create(Vec(230, 317), Port::OUTPUT, module, Clouds::OUT_R_OUTPUT)); - - struct FreezeLight : YellowLight { - FreezeLight() { - box.size = Vec(28-6, 28-6); - bgColor = COLOR_BLACK_TRANSPARENT; - } - }; - addChild(ModuleLightWidget::create(Vec(12+3, 43+3), module, Clouds::FREEZE_LIGHT)); - addChild(ModuleLightWidget::create>(Vec(82.5, 53), module, Clouds::MIX_GREEN_LIGHT)); - addChild(ModuleLightWidget::create>(Vec(114.5, 53), module, Clouds::PAN_GREEN_LIGHT)); - addChild(ModuleLightWidget::create>(Vec(145.5, 53), module, Clouds::FEEDBACK_GREEN_LIGHT)); - addChild(ModuleLightWidget::create>(Vec(177.5, 53), module, Clouds::REVERB_GREEN_LIGHT)); -} -void CloudsWidget::step() { - Clouds *module = dynamic_cast(this->module); - - blendParam->visible = (module->blendMode == 0); - spreadParam->visible = (module->blendMode == 1); - feedbackParam->visible = (module->blendMode == 2); - reverbParam->visible = (module->blendMode == 3); - - ModuleWidget::step(); -} +struct FreezeLight : YellowLight { + FreezeLight() { + box.size = Vec(28-6, 28-6); + bgColor = COLOR_BLACK_TRANSPARENT; + } +}; struct CloudsBlendItem : MenuItem { @@ -370,30 +303,95 @@ struct CloudsQualityItem : MenuItem { }; -Menu *CloudsWidget::createContextMenu() { - Menu *menu = ModuleWidget::createContextMenu(); - Clouds *module = dynamic_cast(this->module); - - menu->addChild(construct()); - menu->addChild(construct(&MenuEntry::text, "Blend knob")); - menu->addChild(construct(&MenuEntry::text, "Wet/dry", &CloudsBlendItem::module, module, &CloudsBlendItem::blendMode, 0)); - menu->addChild(construct(&MenuEntry::text, "Spread", &CloudsBlendItem::module, module, &CloudsBlendItem::blendMode, 1)); - menu->addChild(construct(&MenuEntry::text, "Feedback", &CloudsBlendItem::module, module, &CloudsBlendItem::blendMode, 2)); - menu->addChild(construct(&MenuEntry::text, "Reverb", &CloudsBlendItem::module, module, &CloudsBlendItem::blendMode, 3)); - - menu->addChild(construct()); - menu->addChild(construct(&MenuEntry::text, "Alternative mode")); - menu->addChild(construct(&MenuEntry::text, "Granular", &CloudsPlaybackItem::module, module, &CloudsPlaybackItem::playback, clouds::PLAYBACK_MODE_GRANULAR)); - menu->addChild(construct(&MenuEntry::text, "Pitch-shifter/time-stretcher", &CloudsPlaybackItem::module, module, &CloudsPlaybackItem::playback, clouds::PLAYBACK_MODE_STRETCH)); - menu->addChild(construct(&MenuEntry::text, "Looping delay", &CloudsPlaybackItem::module, module, &CloudsPlaybackItem::playback, clouds::PLAYBACK_MODE_LOOPING_DELAY)); - menu->addChild(construct(&MenuEntry::text, "Spectral madness", &CloudsPlaybackItem::module, module, &CloudsPlaybackItem::playback, clouds::PLAYBACK_MODE_SPECTRAL)); - - menu->addChild(construct()); - menu->addChild(construct(&MenuEntry::text, "Quality")); - menu->addChild(construct(&MenuEntry::text, "1s 32kHz 16-bit stereo", &CloudsQualityItem::module, module, &CloudsQualityItem::quality, 0)); - menu->addChild(construct(&MenuEntry::text, "2s 32kHz 16-bit mono", &CloudsQualityItem::module, module, &CloudsQualityItem::quality, 1)); - menu->addChild(construct(&MenuEntry::text, "4s 16kHz 8-bit µ-law stereo", &CloudsQualityItem::module, module, &CloudsQualityItem::quality, 2)); - menu->addChild(construct(&MenuEntry::text, "8s 16kHz 8-bit µ-law mono", &CloudsQualityItem::module, module, &CloudsQualityItem::quality, 3)); - - return menu; -} +struct CloudsWidget : ModuleWidget { + ParamWidget *blendParam; + ParamWidget *spreadParam; + ParamWidget *feedbackParam; + ParamWidget *reverbParam; + + CloudsWidget(Clouds *module) : ModuleWidget(module) { + setPanel(SVG::load(assetPlugin(plugin, "res/Clouds.svg"))); + + addChild(Widget::create(Vec(15, 0))); + addChild(Widget::create(Vec(240, 0))); + addChild(Widget::create(Vec(15, 365))); + addChild(Widget::create(Vec(240, 365))); + + addParam(ParamWidget::create(Vec(27, 93), module, Clouds::POSITION_PARAM, 0.0, 1.0, 0.5)); + addParam(ParamWidget::create(Vec(108, 93), module, Clouds::SIZE_PARAM, 0.0, 1.0, 0.5)); + addParam(ParamWidget::create(Vec(190, 93), module, Clouds::PITCH_PARAM, -2.0, 2.0, 0.0)); + + addParam(ParamWidget::create(Vec(14, 180), module, Clouds::IN_GAIN_PARAM, 0.0, 1.0, 0.5)); + addParam(ParamWidget::create(Vec(81, 180), module, Clouds::DENSITY_PARAM, 0.0, 1.0, 0.5)); + addParam(ParamWidget::create(Vec(146, 180), module, Clouds::TEXTURE_PARAM, 0.0, 1.0, 0.5)); + blendParam = ParamWidget::create(Vec(213, 180), module, Clouds::BLEND_PARAM, 0.0, 1.0, 0.5); + addParam(blendParam); + spreadParam = ParamWidget::create(Vec(213, 180), module, Clouds::SPREAD_PARAM, 0.0, 1.0, 0.0); + addParam(spreadParam); + feedbackParam = ParamWidget::create(Vec(213, 180), module, Clouds::FEEDBACK_PARAM, 0.0, 1.0, 0.0); + addParam(feedbackParam); + reverbParam = ParamWidget::create(Vec(213, 180), module, Clouds::REVERB_PARAM, 0.0, 1.0, 0.0); + addParam(reverbParam); + + addParam(ParamWidget::create(Vec(12, 43), module, Clouds::FREEZE_PARAM, 0.0, 1.0, 0.0)); + addParam(ParamWidget::create(Vec(211, 50), module, Clouds::MODE_PARAM, 0.0, 1.0, 0.0)); + addParam(ParamWidget::create(Vec(239, 50), module, Clouds::LOAD_PARAM, 0.0, 1.0, 0.0)); + + addInput(Port::create(Vec(15, 274), Port::INPUT, module, Clouds::FREEZE_INPUT)); + addInput(Port::create(Vec(58, 274), Port::INPUT, module, Clouds::TRIG_INPUT)); + addInput(Port::create(Vec(101, 274), Port::INPUT, module, Clouds::POSITION_INPUT)); + addInput(Port::create(Vec(144, 274), Port::INPUT, module, Clouds::SIZE_INPUT)); + addInput(Port::create(Vec(188, 274), Port::INPUT, module, Clouds::PITCH_INPUT)); + addInput(Port::create(Vec(230, 274), Port::INPUT, module, Clouds::BLEND_INPUT)); + + addInput(Port::create(Vec(15, 317), Port::INPUT, module, Clouds::IN_L_INPUT)); + addInput(Port::create(Vec(58, 317), Port::INPUT, module, Clouds::IN_R_INPUT)); + addInput(Port::create(Vec(101, 317), Port::INPUT, module, Clouds::DENSITY_INPUT)); + addInput(Port::create(Vec(144, 317), Port::INPUT, module, Clouds::TEXTURE_INPUT)); + addOutput(Port::create(Vec(188, 317), Port::OUTPUT, module, Clouds::OUT_L_OUTPUT)); + addOutput(Port::create(Vec(230, 317), Port::OUTPUT, module, Clouds::OUT_R_OUTPUT)); + + addChild(ModuleLightWidget::create(Vec(12+3, 43+3), module, Clouds::FREEZE_LIGHT)); + addChild(ModuleLightWidget::create>(Vec(82.5, 53), module, Clouds::MIX_GREEN_LIGHT)); + addChild(ModuleLightWidget::create>(Vec(114.5, 53), module, Clouds::PAN_GREEN_LIGHT)); + addChild(ModuleLightWidget::create>(Vec(145.5, 53), module, Clouds::FEEDBACK_GREEN_LIGHT)); + addChild(ModuleLightWidget::create>(Vec(177.5, 53), module, Clouds::REVERB_GREEN_LIGHT)); + } + + void step() override { + Clouds *module = dynamic_cast(this->module); + + blendParam->visible = (module->blendMode == 0); + spreadParam->visible = (module->blendMode == 1); + feedbackParam->visible = (module->blendMode == 2); + reverbParam->visible = (module->blendMode == 3); + + ModuleWidget::step(); + } + + void appendContextMenu(Menu *menu) override { + Clouds *module = dynamic_cast(this->module); + assert(module); + + menu->addChild(construct()); + menu->addChild(construct(&MenuLabel::text, "Blend knob")); + menu->addChild(construct(&MenuItem::text, "Wet/dry", &CloudsBlendItem::module, module, &CloudsBlendItem::blendMode, 0)); + menu->addChild(construct(&MenuItem::text, "Spread", &CloudsBlendItem::module, module, &CloudsBlendItem::blendMode, 1)); + menu->addChild(construct(&MenuItem::text, "Feedback", &CloudsBlendItem::module, module, &CloudsBlendItem::blendMode, 2)); + menu->addChild(construct(&MenuItem::text, "Reverb", &CloudsBlendItem::module, module, &CloudsBlendItem::blendMode, 3)); + + menu->addChild(construct()); + menu->addChild(construct(&MenuLabel::text, "Alternative mode")); + menu->addChild(construct(&MenuItem::text, "Granular", &CloudsPlaybackItem::module, module, &CloudsPlaybackItem::playback, clouds::PLAYBACK_MODE_GRANULAR)); + menu->addChild(construct(&MenuItem::text, "Pitch-shifter/time-stretcher", &CloudsPlaybackItem::module, module, &CloudsPlaybackItem::playback, clouds::PLAYBACK_MODE_STRETCH)); + menu->addChild(construct(&MenuItem::text, "Looping delay", &CloudsPlaybackItem::module, module, &CloudsPlaybackItem::playback, clouds::PLAYBACK_MODE_LOOPING_DELAY)); + menu->addChild(construct(&MenuItem::text, "Spectral madness", &CloudsPlaybackItem::module, module, &CloudsPlaybackItem::playback, clouds::PLAYBACK_MODE_SPECTRAL)); + + menu->addChild(construct()); + menu->addChild(construct(&MenuLabel::text, "Quality")); + menu->addChild(construct(&MenuItem::text, "1s 32kHz 16-bit stereo", &CloudsQualityItem::module, module, &CloudsQualityItem::quality, 0)); + menu->addChild(construct(&MenuItem::text, "2s 32kHz 16-bit mono", &CloudsQualityItem::module, module, &CloudsQualityItem::quality, 1)); + menu->addChild(construct(&MenuItem::text, "4s 16kHz 8-bit µ-law stereo", &CloudsQualityItem::module, module, &CloudsQualityItem::quality, 2)); + menu->addChild(construct(&MenuItem::text, "8s 16kHz 8-bit µ-law mono", &CloudsQualityItem::module, module, &CloudsQualityItem::quality, 3)); + } +}; \ No newline at end of file diff --git a/src/Elements.cpp b/src/Elements.cpp index 8c7fa68..1d95e3e 100644 --- a/src/Elements.cpp +++ b/src/Elements.cpp @@ -214,91 +214,6 @@ void Elements::step() { } -ElementsWidget::ElementsWidget() { - Elements *module = new Elements(); - setModule(module); - box.size = Vec(15*34, 380); - - { - Panel *panel = new LightPanel(); - panel->backgroundImage = Image::load(assetPlugin(plugin, "res/Elements.png")); - panel->box.size = box.size; - addChild(panel); - } - - addChild(Widget::create(Vec(15, 0))); - addChild(Widget::create(Vec(480, 0))); - addChild(Widget::create(Vec(15, 365))); - addChild(Widget::create(Vec(480, 365))); - - addParam(ParamWidget::create(Vec(28, 42), module, Elements::CONTOUR_PARAM, 0.0, 1.0, 1.0)); - addParam(ParamWidget::create(Vec(99, 42), module, Elements::BOW_PARAM, 0.0, 1.0, 0.0)); - addParam(ParamWidget::create(Vec(169, 42), module, Elements::BLOW_PARAM, 0.0, 1.0, 0.0)); - addParam(ParamWidget::create(Vec(239, 42), module, Elements::STRIKE_PARAM, 0.0, 1.0, 0.5)); - addParam(ParamWidget::create(Vec(310, 42), module, Elements::COARSE_PARAM, -30.0, 30.0, 0.0)); - addParam(ParamWidget::create(Vec(381, 42), module, Elements::FINE_PARAM, -2.0, 2.0, 0.0)); - addParam(ParamWidget::create(Vec(451, 42), module, Elements::FM_PARAM, -1.0, 1.0, 0.0)); - - addParam(ParamWidget::create(Vec(115, 116), module, Elements::FLOW_PARAM, 0.0, 1.0, 0.5)); - addParam(ParamWidget::create(Vec(212, 116), module, Elements::MALLET_PARAM, 0.0, 1.0, 0.5)); - addParam(ParamWidget::create(Vec(326, 116), module, Elements::GEOMETRY_PARAM, 0.0, 1.0, 0.5)); - addParam(ParamWidget::create(Vec(423, 116), module, Elements::BRIGHTNESS_PARAM, 0.0, 1.0, 0.5)); - - addParam(ParamWidget::create(Vec(99, 202), module, Elements::BOW_TIMBRE_PARAM, 0.0, 1.0, 0.5)); - addParam(ParamWidget::create(Vec(170, 202), module, Elements::BLOW_TIMBRE_PARAM, 0.0, 1.0, 0.5)); - addParam(ParamWidget::create(Vec(239, 202), module, Elements::STRIKE_TIMBRE_PARAM, 0.0, 1.0, 0.5)); - addParam(ParamWidget::create(Vec(310, 202), module, Elements::DAMPING_PARAM, 0.0, 1.0, 0.5)); - addParam(ParamWidget::create(Vec(380, 202), module, Elements::POSITION_PARAM, 0.0, 1.0, 0.5)); - addParam(ParamWidget::create(Vec(451, 202), module, Elements::SPACE_PARAM, 0.0, 2.0, 0.0)); - - addParam(ParamWidget::create(Vec(104.5, 273), module, Elements::BOW_TIMBRE_MOD_PARAM, -1.0, 1.0, 0.0)); - addParam(ParamWidget::create(Vec(142.5, 273), module, Elements::FLOW_MOD_PARAM, -1.0, 1.0, 0.0)); - addParam(ParamWidget::create(Vec(181.5, 273), module, Elements::BLOW_TIMBRE_MOD_PARAM, -1.0, 1.0, 0.0)); - addParam(ParamWidget::create(Vec(219.5, 273), module, Elements::MALLET_MOD_PARAM, -1.0, 1.0, 0.0)); - addParam(ParamWidget::create(Vec(257.5, 273), module, Elements::STRIKE_TIMBRE_MOD_PARAM, -1.0, 1.0, 0.0)); - addParam(ParamWidget::create(Vec(315.5, 273), module, Elements::DAMPING_MOD_PARAM, -1.0, 1.0, 0.0)); - addParam(ParamWidget::create(Vec(354.5, 273), module, Elements::GEOMETRY_MOD_PARAM, -1.0, 1.0, 0.0)); - addParam(ParamWidget::create(Vec(392.5, 273), module, Elements::POSITION_MOD_PARAM, -1.0, 1.0, 0.0)); - addParam(ParamWidget::create(Vec(430.5, 273), module, Elements::BRIGHTNESS_MOD_PARAM, -1.0, 1.0, 0.0)); - addParam(ParamWidget::create(Vec(469.5, 273), module, Elements::SPACE_MOD_PARAM, -2.0, 2.0, 0.0)); - - addInput(Port::create(Vec(20, 178), Port::INPUT, module, Elements::NOTE_INPUT)); - addInput(Port::create(Vec(55, 178), Port::INPUT, module, Elements::FM_INPUT)); - - addInput(Port::create(Vec(20, 224), Port::INPUT, module, Elements::GATE_INPUT)); - addInput(Port::create(Vec(55, 224), Port::INPUT, module, Elements::STRENGTH_INPUT)); - - addInput(Port::create(Vec(20, 270), Port::INPUT, module, Elements::BLOW_INPUT)); - addInput(Port::create(Vec(55, 270), Port::INPUT, module, Elements::STRIKE_INPUT)); - - addOutput(Port::create(Vec(20, 316), Port::OUTPUT, module, Elements::AUX_OUTPUT)); - addOutput(Port::create(Vec(55, 316), Port::OUTPUT, module, Elements::MAIN_OUTPUT)); - - addInput(Port::create(Vec(101, 316), Port::INPUT, module, Elements::BOW_TIMBRE_MOD_INPUT)); - addInput(Port::create(Vec(139, 316), Port::INPUT, module, Elements::FLOW_MOD_INPUT)); - addInput(Port::create(Vec(178, 316), Port::INPUT, module, Elements::BLOW_TIMBRE_MOD_INPUT)); - addInput(Port::create(Vec(216, 316), Port::INPUT, module, Elements::MALLET_MOD_INPUT)); - addInput(Port::create(Vec(254, 316), Port::INPUT, module, Elements::STRIKE_TIMBRE_MOD_INPUT)); - addInput(Port::create(Vec(312, 316), Port::INPUT, module, Elements::DAMPING_MOD_INPUT)); - addInput(Port::create(Vec(350, 316), Port::INPUT, module, Elements::GEOMETRY_MOD_INPUT)); - addInput(Port::create(Vec(389, 316), Port::INPUT, module, Elements::POSITION_MOD_INPUT)); - addInput(Port::create(Vec(427, 316), Port::INPUT, module, Elements::BRIGHTNESS_MOD_INPUT)); - addInput(Port::create(Vec(466, 316), Port::INPUT, module, Elements::SPACE_MOD_INPUT)); - - addParam(ParamWidget::create(Vec(36, 116), module, Elements::PLAY_PARAM, 0.0, 1.0, 0.0)); - - struct GateLight : YellowLight { - GateLight() { - box.size = Vec(28-6, 28-6); - bgColor = COLOR_BLACK_TRANSPARENT; - } - }; - - addChild(ModuleLightWidget::create(Vec(36+3, 116+3), module, Elements::GATE_LIGHT)); - addChild(ModuleLightWidget::create>(Vec(184, 165), module, Elements::EXCITER_LIGHT)); - addChild(ModuleLightWidget::create>(Vec(395, 165), module, Elements::RESONATOR_LIGHT)); -} - struct ElementsModalItem : MenuItem { Elements *elements; int model; @@ -311,17 +226,92 @@ struct ElementsModalItem : MenuItem { } }; -Menu *ElementsWidget::createContextMenu() { - Menu *menu = ModuleWidget::createContextMenu(); - Elements *elements = dynamic_cast(module); - assert(elements); +struct RampageWidget : ModuleWidget { + RampageWidget(Elements *module) : ModuleWidget(module) { + setPanel(SVG::load(assetPlugin(plugin, "res/Elements.svg"))); + + addChild(Widget::create(Vec(15, 0))); + addChild(Widget::create(Vec(480, 0))); + addChild(Widget::create(Vec(15, 365))); + addChild(Widget::create(Vec(480, 365))); + + addParam(ParamWidget::create(Vec(28, 42), module, Elements::CONTOUR_PARAM, 0.0, 1.0, 1.0)); + addParam(ParamWidget::create(Vec(99, 42), module, Elements::BOW_PARAM, 0.0, 1.0, 0.0)); + addParam(ParamWidget::create(Vec(169, 42), module, Elements::BLOW_PARAM, 0.0, 1.0, 0.0)); + addParam(ParamWidget::create(Vec(239, 42), module, Elements::STRIKE_PARAM, 0.0, 1.0, 0.5)); + addParam(ParamWidget::create(Vec(310, 42), module, Elements::COARSE_PARAM, -30.0, 30.0, 0.0)); + addParam(ParamWidget::create(Vec(381, 42), module, Elements::FINE_PARAM, -2.0, 2.0, 0.0)); + addParam(ParamWidget::create(Vec(451, 42), module, Elements::FM_PARAM, -1.0, 1.0, 0.0)); + + addParam(ParamWidget::create(Vec(115, 116), module, Elements::FLOW_PARAM, 0.0, 1.0, 0.5)); + addParam(ParamWidget::create(Vec(212, 116), module, Elements::MALLET_PARAM, 0.0, 1.0, 0.5)); + addParam(ParamWidget::create(Vec(326, 116), module, Elements::GEOMETRY_PARAM, 0.0, 1.0, 0.5)); + addParam(ParamWidget::create(Vec(423, 116), module, Elements::BRIGHTNESS_PARAM, 0.0, 1.0, 0.5)); + + addParam(ParamWidget::create(Vec(99, 202), module, Elements::BOW_TIMBRE_PARAM, 0.0, 1.0, 0.5)); + addParam(ParamWidget::create(Vec(170, 202), module, Elements::BLOW_TIMBRE_PARAM, 0.0, 1.0, 0.5)); + addParam(ParamWidget::create(Vec(239, 202), module, Elements::STRIKE_TIMBRE_PARAM, 0.0, 1.0, 0.5)); + addParam(ParamWidget::create(Vec(310, 202), module, Elements::DAMPING_PARAM, 0.0, 1.0, 0.5)); + addParam(ParamWidget::create(Vec(380, 202), module, Elements::POSITION_PARAM, 0.0, 1.0, 0.5)); + addParam(ParamWidget::create(Vec(451, 202), module, Elements::SPACE_PARAM, 0.0, 2.0, 0.0)); + + addParam(ParamWidget::create(Vec(104.5, 273), module, Elements::BOW_TIMBRE_MOD_PARAM, -1.0, 1.0, 0.0)); + addParam(ParamWidget::create(Vec(142.5, 273), module, Elements::FLOW_MOD_PARAM, -1.0, 1.0, 0.0)); + addParam(ParamWidget::create(Vec(181.5, 273), module, Elements::BLOW_TIMBRE_MOD_PARAM, -1.0, 1.0, 0.0)); + addParam(ParamWidget::create(Vec(219.5, 273), module, Elements::MALLET_MOD_PARAM, -1.0, 1.0, 0.0)); + addParam(ParamWidget::create(Vec(257.5, 273), module, Elements::STRIKE_TIMBRE_MOD_PARAM, -1.0, 1.0, 0.0)); + addParam(ParamWidget::create(Vec(315.5, 273), module, Elements::DAMPING_MOD_PARAM, -1.0, 1.0, 0.0)); + addParam(ParamWidget::create(Vec(354.5, 273), module, Elements::GEOMETRY_MOD_PARAM, -1.0, 1.0, 0.0)); + addParam(ParamWidget::create(Vec(392.5, 273), module, Elements::POSITION_MOD_PARAM, -1.0, 1.0, 0.0)); + addParam(ParamWidget::create(Vec(430.5, 273), module, Elements::BRIGHTNESS_MOD_PARAM, -1.0, 1.0, 0.0)); + addParam(ParamWidget::create(Vec(469.5, 273), module, Elements::SPACE_MOD_PARAM, -2.0, 2.0, 0.0)); + + addInput(Port::create(Vec(20, 178), Port::INPUT, module, Elements::NOTE_INPUT)); + addInput(Port::create(Vec(55, 178), Port::INPUT, module, Elements::FM_INPUT)); + + addInput(Port::create(Vec(20, 224), Port::INPUT, module, Elements::GATE_INPUT)); + addInput(Port::create(Vec(55, 224), Port::INPUT, module, Elements::STRENGTH_INPUT)); + + addInput(Port::create(Vec(20, 270), Port::INPUT, module, Elements::BLOW_INPUT)); + addInput(Port::create(Vec(55, 270), Port::INPUT, module, Elements::STRIKE_INPUT)); + + addOutput(Port::create(Vec(20, 316), Port::OUTPUT, module, Elements::AUX_OUTPUT)); + addOutput(Port::create(Vec(55, 316), Port::OUTPUT, module, Elements::MAIN_OUTPUT)); + + addInput(Port::create(Vec(101, 316), Port::INPUT, module, Elements::BOW_TIMBRE_MOD_INPUT)); + addInput(Port::create(Vec(139, 316), Port::INPUT, module, Elements::FLOW_MOD_INPUT)); + addInput(Port::create(Vec(178, 316), Port::INPUT, module, Elements::BLOW_TIMBRE_MOD_INPUT)); + addInput(Port::create(Vec(216, 316), Port::INPUT, module, Elements::MALLET_MOD_INPUT)); + addInput(Port::create(Vec(254, 316), Port::INPUT, module, Elements::STRIKE_TIMBRE_MOD_INPUT)); + addInput(Port::create(Vec(312, 316), Port::INPUT, module, Elements::DAMPING_MOD_INPUT)); + addInput(Port::create(Vec(350, 316), Port::INPUT, module, Elements::GEOMETRY_MOD_INPUT)); + addInput(Port::create(Vec(389, 316), Port::INPUT, module, Elements::POSITION_MOD_INPUT)); + addInput(Port::create(Vec(427, 316), Port::INPUT, module, Elements::BRIGHTNESS_MOD_INPUT)); + addInput(Port::create(Vec(466, 316), Port::INPUT, module, Elements::SPACE_MOD_INPUT)); + + addParam(ParamWidget::create(Vec(36, 116), module, Elements::PLAY_PARAM, 0.0, 1.0, 0.0)); + + struct GateLight : YellowLight { + GateLight() { + box.size = Vec(28-6, 28-6); + bgColor = COLOR_BLACK_TRANSPARENT; + } + }; + + addChild(ModuleLightWidget::create(Vec(36+3, 116+3), module, Elements::GATE_LIGHT)); + addChild(ModuleLightWidget::create>(Vec(184, 165), module, Elements::EXCITER_LIGHT)); + addChild(ModuleLightWidget::create>(Vec(395, 165), module, Elements::RESONATOR_LIGHT)); + } - menu->addChild(construct()); - menu->addChild(construct(&MenuEntry::text, "Alternative models")); - menu->addChild(construct(&MenuEntry::text, "Original", &ElementsModalItem::elements, elements, &ElementsModalItem::model, 0)); - menu->addChild(construct(&MenuEntry::text, "Non-linear string", &ElementsModalItem::elements, elements, &ElementsModalItem::model, 1)); - menu->addChild(construct(&MenuEntry::text, "Chords", &ElementsModalItem::elements, elements, &ElementsModalItem::model, 2)); + void appendContextMenu(Menu *menu) override { + Elements *elements = dynamic_cast(module); + assert(elements); - return menu; -} + menu->addChild(construct()); + menu->addChild(construct(&MenuLabel::text, "Alternative models")); + menu->addChild(construct(&MenuItem::text, "Original", &ElementsModalItem::elements, elements, &ElementsModalItem::model, 0)); + menu->addChild(construct(&MenuItem::text, "Non-linear string", &ElementsModalItem::elements, elements, &ElementsModalItem::model, 1)); + menu->addChild(construct(&MenuItem::text, "Chords", &ElementsModalItem::elements, elements, &ElementsModalItem::model, 2)); + } +}; \ No newline at end of file diff --git a/src/Frames.cpp b/src/Frames.cpp index 1e168c5..fc2da46 100644 --- a/src/Frames.cpp +++ b/src/Frames.cpp @@ -285,154 +285,140 @@ struct CKSSRot : SVGSwitch, ToggleSwitch { }; -FramesWidget::FramesWidget() { - Frames *module = new Frames(); - setModule(module); - box.size = Vec(15*18, 380); - - { - Panel *panel = new LightPanel(); - panel->backgroundImage = Image::load(assetPlugin(plugin, "res/Frames.png")); - panel->box.size = box.size; - addChild(panel); +struct FramesWidget : ModuleWidget { + FramesWidget(Frames *module) : ModuleWidget(module) { + setPanel(SVG::load(assetPlugin(plugin, "res/Frames.svg"))); + + addChild(Widget::create(Vec(15, 0))); + addChild(Widget::create(Vec(box.size.x-30, 0))); + addChild(Widget::create(Vec(15, 365))); + addChild(Widget::create(Vec(box.size.x-30, 365))); + + addParam(ParamWidget::create(Vec(14, 52), module, Frames::GAIN1_PARAM, 0.0, 1.0, 0.0)); + addParam(ParamWidget::create(Vec(81, 52), module, Frames::GAIN2_PARAM, 0.0, 1.0, 0.0)); + addParam(ParamWidget::create(Vec(149, 52), module, Frames::GAIN3_PARAM, 0.0, 1.0, 0.0)); + addParam(ParamWidget::create(Vec(216, 52), module, Frames::GAIN4_PARAM, 0.0, 1.0, 0.0)); + addParam(ParamWidget::create(Vec(89, 115), module, Frames::FRAME_PARAM, 0.0, 1.0, 0.0)); + addParam(ParamWidget::create(Vec(208, 141), module, Frames::MODULATION_PARAM, -1.0, 1.0, 0.0)); + addParam(ParamWidget::create(Vec(19, 123), module, Frames::ADD_PARAM, 0.0, 1.0, 0.0)); + addParam(ParamWidget::create(Vec(19, 172), module, Frames::DEL_PARAM, 0.0, 1.0, 0.0)); + addParam(ParamWidget::create(Vec(18, 239), module, Frames::OFFSET_PARAM, 0.0, 1.0, 0.0)); + + addInput(Port::create(Vec(16, 273), Port::INPUT, module, Frames::ALL_INPUT)); + addInput(Port::create(Vec(59, 273), Port::INPUT, module, Frames::IN1_INPUT)); + addInput(Port::create(Vec(102, 273), Port::INPUT, module, Frames::IN2_INPUT)); + addInput(Port::create(Vec(145, 273), Port::INPUT, module, Frames::IN3_INPUT)); + addInput(Port::create(Vec(188, 273), Port::INPUT, module, Frames::IN4_INPUT)); + addInput(Port::create(Vec(231, 273), Port::INPUT, module, Frames::FRAME_INPUT)); + + addOutput(Port::create(Vec(16, 315), Port::OUTPUT, module, Frames::MIX_OUTPUT)); + addOutput(Port::create(Vec(59, 315), Port::OUTPUT, module, Frames::OUT1_OUTPUT)); + addOutput(Port::create(Vec(102, 315), Port::OUTPUT, module, Frames::OUT2_OUTPUT)); + addOutput(Port::create(Vec(145, 315), Port::OUTPUT, module, Frames::OUT3_OUTPUT)); + addOutput(Port::create(Vec(188, 315), Port::OUTPUT, module, Frames::OUT4_OUTPUT)); + addOutput(Port::create(Vec(231, 315), Port::OUTPUT, module, Frames::FRAME_STEP_OUTPUT)); + + addChild(ModuleLightWidget::create>(Vec(30, 101), module, Frames::GAIN1_LIGHT + 0)); + addChild(ModuleLightWidget::create>(Vec(97, 101), module, Frames::GAIN1_LIGHT + 1)); + addChild(ModuleLightWidget::create>(Vec(165, 101), module, Frames::GAIN1_LIGHT + 2)); + addChild(ModuleLightWidget::create>(Vec(232, 101), module, Frames::GAIN1_LIGHT + 3)); + addChild(ModuleLightWidget::create>(Vec(61, 155), module, Frames::EDIT_LIGHT)); + + struct FrameLight : RedGreenBlueLight { + FrameLight() { + box.size = Vec(71, 71); + } + }; + addChild(ModuleLightWidget::create(Vec(100, 126), module, Frames::FRAME_LIGHT)); } - addChild(Widget::create(Vec(15, 0))); - addChild(Widget::create(Vec(box.size.x-30, 0))); - addChild(Widget::create(Vec(15, 365))); - addChild(Widget::create(Vec(box.size.x-30, 365))); - - addParam(ParamWidget::create(Vec(14, 52), module, Frames::GAIN1_PARAM, 0.0, 1.0, 0.0)); - addParam(ParamWidget::create(Vec(81, 52), module, Frames::GAIN2_PARAM, 0.0, 1.0, 0.0)); - addParam(ParamWidget::create(Vec(149, 52), module, Frames::GAIN3_PARAM, 0.0, 1.0, 0.0)); - addParam(ParamWidget::create(Vec(216, 52), module, Frames::GAIN4_PARAM, 0.0, 1.0, 0.0)); - addParam(ParamWidget::create(Vec(89, 115), module, Frames::FRAME_PARAM, 0.0, 1.0, 0.0)); - addParam(ParamWidget::create(Vec(208, 141), module, Frames::MODULATION_PARAM, -1.0, 1.0, 0.0)); - addParam(ParamWidget::create(Vec(19, 123), module, Frames::ADD_PARAM, 0.0, 1.0, 0.0)); - addParam(ParamWidget::create(Vec(19, 172), module, Frames::DEL_PARAM, 0.0, 1.0, 0.0)); - addParam(ParamWidget::create(Vec(18, 239), module, Frames::OFFSET_PARAM, 0.0, 1.0, 0.0)); - - addInput(Port::create(Vec(16, 273), Port::INPUT, module, Frames::ALL_INPUT)); - addInput(Port::create(Vec(59, 273), Port::INPUT, module, Frames::IN1_INPUT)); - addInput(Port::create(Vec(102, 273), Port::INPUT, module, Frames::IN2_INPUT)); - addInput(Port::create(Vec(145, 273), Port::INPUT, module, Frames::IN3_INPUT)); - addInput(Port::create(Vec(188, 273), Port::INPUT, module, Frames::IN4_INPUT)); - addInput(Port::create(Vec(231, 273), Port::INPUT, module, Frames::FRAME_INPUT)); - - addOutput(Port::create(Vec(16, 315), Port::OUTPUT, module, Frames::MIX_OUTPUT)); - addOutput(Port::create(Vec(59, 315), Port::OUTPUT, module, Frames::OUT1_OUTPUT)); - addOutput(Port::create(Vec(102, 315), Port::OUTPUT, module, Frames::OUT2_OUTPUT)); - addOutput(Port::create(Vec(145, 315), Port::OUTPUT, module, Frames::OUT3_OUTPUT)); - addOutput(Port::create(Vec(188, 315), Port::OUTPUT, module, Frames::OUT4_OUTPUT)); - addOutput(Port::create(Vec(231, 315), Port::OUTPUT, module, Frames::FRAME_STEP_OUTPUT)); - - addChild(ModuleLightWidget::create>(Vec(30, 101), module, Frames::GAIN1_LIGHT + 0)); - addChild(ModuleLightWidget::create>(Vec(97, 101), module, Frames::GAIN1_LIGHT + 1)); - addChild(ModuleLightWidget::create>(Vec(165, 101), module, Frames::GAIN1_LIGHT + 2)); - addChild(ModuleLightWidget::create>(Vec(232, 101), module, Frames::GAIN1_LIGHT + 3)); - addChild(ModuleLightWidget::create>(Vec(61, 155), module, Frames::EDIT_LIGHT)); - - struct FrameLight : RedGreenBlueLight { - FrameLight() { - box.size = Vec(71, 71); - } - }; - addChild(ModuleLightWidget::create(Vec(100, 126), module, Frames::FRAME_LIGHT)); -} -struct FramesCurveItem : MenuItem { - Frames *frames; - uint8_t channel; - frames::EasingCurve curve; - void onAction(EventAction &e) override { - frames->keyframer.mutable_settings(channel)->easing_curve = curve; - } - void step() override { - rightText = (frames->keyframer.mutable_settings(channel)->easing_curve == curve) ? "✔" : ""; - MenuItem::step(); - } -}; + void appendContextMenu(Menu *menu) override { + Frames *frames = dynamic_cast(module); + assert(frames); -struct FramesResponseItem : MenuItem { - Frames *frames; - uint8_t channel; - uint8_t response; - void onAction(EventAction &e) override { - frames->keyframer.mutable_settings(channel)->response = response; - } - void step() override { - rightText = (frames->keyframer.mutable_settings(channel)->response == response) ? "✔" : ""; - MenuItem::step(); - } -}; + struct FramesCurveItem : MenuItem { + Frames *frames; + uint8_t channel; + frames::EasingCurve curve; + void onAction(EventAction &e) override { + frames->keyframer.mutable_settings(channel)->easing_curve = curve; + } + void step() override { + rightText = (frames->keyframer.mutable_settings(channel)->easing_curve == curve) ? "✔" : ""; + MenuItem::step(); + } + }; + + struct FramesResponseItem : MenuItem { + Frames *frames; + uint8_t channel; + uint8_t response; + void onAction(EventAction &e) override { + frames->keyframer.mutable_settings(channel)->response = response; + } + void step() override { + rightText = (frames->keyframer.mutable_settings(channel)->response == response) ? "✔" : ""; + MenuItem::step(); + } + }; + + struct FramesChannelSettingsItem : MenuItem { + Frames *frames; + uint8_t channel; + Menu *createChildMenu() override { + Menu *menu = new Menu(); + + menu->addChild(construct(&MenuLabel::text, stringf("Channel %d", channel + 1))); + menu->addChild(construct()); + + menu->addChild(construct(&MenuLabel::text, "Interpolation Curve")); + menu->addChild(construct(&MenuItem::text, "Step", &FramesCurveItem::frames, frames, &FramesCurveItem::channel, channel, &FramesCurveItem::curve, frames::EASING_CURVE_STEP)); + menu->addChild(construct(&MenuItem::text, "Linear", &FramesCurveItem::frames, frames, &FramesCurveItem::channel, channel, &FramesCurveItem::curve, frames::EASING_CURVE_LINEAR)); + menu->addChild(construct(&MenuItem::text, "Accelerating", &FramesCurveItem::frames, frames, &FramesCurveItem::channel, channel, &FramesCurveItem::curve, frames::EASING_CURVE_IN_QUARTIC)); + menu->addChild(construct(&MenuItem::text, "Decelerating", &FramesCurveItem::frames, frames, &FramesCurveItem::channel, channel, &FramesCurveItem::curve, frames::EASING_CURVE_OUT_QUARTIC)); + menu->addChild(construct(&MenuItem::text, "Smooth Departure/Arrival", &FramesCurveItem::frames, frames, &FramesCurveItem::channel, channel, &FramesCurveItem::curve, frames::EASING_CURVE_SINE)); + menu->addChild(construct(&MenuItem::text, "Bouncing", &FramesCurveItem::frames, frames, &FramesCurveItem::channel, channel, &FramesCurveItem::curve, frames::EASING_CURVE_BOUNCE)); + menu->addChild(construct()); + menu->addChild(construct(&MenuLabel::text, "Response Curve")); + menu->addChild(construct(&MenuItem::text, "Linear", &FramesResponseItem::frames, frames, &FramesResponseItem::channel, channel, &FramesResponseItem::response, 0)); + menu->addChild(construct(&MenuItem::text, "Exponential", &FramesResponseItem::frames, frames, &FramesResponseItem::channel, channel, &FramesResponseItem::response, 255)); + + return menu; + } + }; + struct FramesClearItem : MenuItem { + Frames *frames; + void onAction(EventAction &e) override { + frames->keyframer.Clear(); + } + }; -struct FramesChannelSettingsItem : MenuItem { - Frames *frames; - uint8_t channel; - Menu *createChildMenu() override { - Menu *menu = new Menu(); + struct FramesModeItem : MenuItem { + Frames *frames; + bool poly_lfo_mode; + void onAction(EventAction &e) override { + frames->poly_lfo_mode = poly_lfo_mode; + } + void step() override { + rightText = (frames->poly_lfo_mode == poly_lfo_mode) ? "✔" : ""; + MenuItem::step(); + } + }; - menu->addChild(construct(&MenuEntry::text, stringf("Channel %d", channel + 1))); menu->addChild(construct()); + menu->addChild(construct(&MenuLabel::text, "Channel Settings")); + for (int i = 0; i < 4; i++) { + menu->addChild(construct(&MenuItem::text, stringf("Channel %d", i + 1), &FramesChannelSettingsItem::frames, frames, &FramesChannelSettingsItem::channel, i)); + } + menu->addChild(construct(&MenuItem::text, "Clear Keyframes", &FramesClearItem::frames, frames)); - menu->addChild(construct(&MenuEntry::text, "Interpolation Curve")); - menu->addChild(construct(&MenuEntry::text, "Step", &FramesCurveItem::frames, frames, &FramesCurveItem::channel, channel, &FramesCurveItem::curve, frames::EASING_CURVE_STEP)); - menu->addChild(construct(&MenuEntry::text, "Linear", &FramesCurveItem::frames, frames, &FramesCurveItem::channel, channel, &FramesCurveItem::curve, frames::EASING_CURVE_LINEAR)); - menu->addChild(construct(&MenuEntry::text, "Accelerating", &FramesCurveItem::frames, frames, &FramesCurveItem::channel, channel, &FramesCurveItem::curve, frames::EASING_CURVE_IN_QUARTIC)); - menu->addChild(construct(&MenuEntry::text, "Decelerating", &FramesCurveItem::frames, frames, &FramesCurveItem::channel, channel, &FramesCurveItem::curve, frames::EASING_CURVE_OUT_QUARTIC)); - menu->addChild(construct(&MenuEntry::text, "Smooth Departure/Arrival", &FramesCurveItem::frames, frames, &FramesCurveItem::channel, channel, &FramesCurveItem::curve, frames::EASING_CURVE_SINE)); - menu->addChild(construct(&MenuEntry::text, "Bouncing", &FramesCurveItem::frames, frames, &FramesCurveItem::channel, channel, &FramesCurveItem::curve, frames::EASING_CURVE_BOUNCE)); menu->addChild(construct()); - menu->addChild(construct(&MenuEntry::text, "Response Curve")); - menu->addChild(construct(&MenuEntry::text, "Linear", &FramesResponseItem::frames, frames, &FramesResponseItem::channel, channel, &FramesResponseItem::response, 0)); - menu->addChild(construct(&MenuEntry::text, "Exponential", &FramesResponseItem::frames, frames, &FramesResponseItem::channel, channel, &FramesResponseItem::response, 255)); - - return menu; - } -}; - - -struct FramesClearItem : MenuItem { - Frames *frames; - void onAction(EventAction &e) override { - frames->keyframer.Clear(); - } -}; - - -struct FramesModeItem : MenuItem { - Frames *frames; - bool poly_lfo_mode; - void onAction(EventAction &e) override { - frames->poly_lfo_mode = poly_lfo_mode; - } - void step() override { - rightText = (frames->poly_lfo_mode == poly_lfo_mode) ? "✔" : ""; - MenuItem::step(); + menu->addChild(construct(&MenuLabel::text, "Mode")); + menu->addChild(construct(&MenuItem::text, "Keyframer", &FramesModeItem::frames, frames, &FramesModeItem::poly_lfo_mode, false)); + menu->addChild(construct(&MenuItem::text, "Poly LFO", &FramesModeItem::frames, frames, &FramesModeItem::poly_lfo_mode, true)); } -}; - - -Menu *FramesWidget::createContextMenu() { - Menu *menu = ModuleWidget::createContextMenu(); - - Frames *frames = dynamic_cast(module); - assert(frames); - - menu->addChild(construct()); - menu->addChild(construct(&MenuEntry::text, "Channel Settings")); - for (int i = 0; i < 4; i++) { - menu->addChild(construct(&MenuItem::text, stringf("Channel %d", i + 1), &FramesChannelSettingsItem::frames, frames, &FramesChannelSettingsItem::channel, i)); - } - menu->addChild(construct(&MenuItem::text, "Clear Keyframes", &FramesClearItem::frames, frames)); - - menu->addChild(construct()); - menu->addChild(construct(&MenuEntry::text, "Mode")); - menu->addChild(construct(&MenuItem::text, "Keyframer", &FramesModeItem::frames, frames, &FramesModeItem::poly_lfo_mode, false)); - menu->addChild(construct(&MenuItem::text, "Poly LFO", &FramesModeItem::frames, frames, &FramesModeItem::poly_lfo_mode, true)); - - return menu; -} +}; \ No newline at end of file diff --git a/src/Kinks.cpp b/src/Kinks.cpp index f02689d..33f050e 100644 --- a/src/Kinks.cpp +++ b/src/Kinks.cpp @@ -68,37 +68,30 @@ void Kinks::step() { } -KinksWidget::KinksWidget() { - Kinks *module = new Kinks(); - setModule(module); - box.size = Vec(15*4, 380); - - { - Panel *panel = new LightPanel(); - panel->backgroundImage = Image::load(assetPlugin(plugin, "res/Kinks.png")); - panel->box.size = box.size; - addChild(panel); +struct KinksWidget : ModuleWidget { + KinksWidget(Kinks *module) : ModuleWidget(module) { + setPanel(SVG::load(assetPlugin(plugin, "res/Kinks.svg"))); + + addChild(Widget::create(Vec(15, 0))); + addChild(Widget::create(Vec(15, 365))); + + addInput(Port::create(Vec(4, 75), Port::INPUT, module, Kinks::SIGN_INPUT)); + addOutput(Port::create(Vec(31, 75), Port::OUTPUT, module, Kinks::INVERT_OUTPUT)); + addOutput(Port::create(Vec(4, 113), Port::OUTPUT, module, Kinks::HALF_RECTIFY_OUTPUT)); + addOutput(Port::create(Vec(31, 113), Port::OUTPUT, module, Kinks::FULL_RECTIFY_OUTPUT)); + + addInput(Port::create(Vec(4, 177), Port::INPUT, module, Kinks::LOGIC_A_INPUT)); + addInput(Port::create(Vec(31, 177), Port::INPUT, module, Kinks::LOGIC_B_INPUT)); + addOutput(Port::create(Vec(4, 214), Port::OUTPUT, module, Kinks::MAX_OUTPUT)); + addOutput(Port::create(Vec(31, 214), Port::OUTPUT, module, Kinks::MIN_OUTPUT)); + + addInput(Port::create(Vec(4, 278), Port::INPUT, module, Kinks::SH_INPUT)); + addInput(Port::create(Vec(31, 278), Port::INPUT, module, Kinks::TRIG_INPUT)); + addOutput(Port::create(Vec(4, 316), Port::OUTPUT, module, Kinks::NOISE_OUTPUT)); + addOutput(Port::create(Vec(31, 316), Port::OUTPUT, module, Kinks::SH_OUTPUT)); + + addChild(ModuleLightWidget::create>(Vec(11, 59), module, Kinks::SIGN_POS_LIGHT)); + addChild(ModuleLightWidget::create>(Vec(11, 161), module, Kinks::LOGIC_POS_LIGHT)); + addChild(ModuleLightWidget::create>(Vec(11, 262), module, Kinks::SH_POS_LIGHT)); } - - addChild(Widget::create(Vec(15, 0))); - addChild(Widget::create(Vec(15, 365))); - - addInput(Port::create(Vec(4, 75), Port::INPUT, module, Kinks::SIGN_INPUT)); - addOutput(Port::create(Vec(31, 75), Port::OUTPUT, module, Kinks::INVERT_OUTPUT)); - addOutput(Port::create(Vec(4, 113), Port::OUTPUT, module, Kinks::HALF_RECTIFY_OUTPUT)); - addOutput(Port::create(Vec(31, 113), Port::OUTPUT, module, Kinks::FULL_RECTIFY_OUTPUT)); - - addInput(Port::create(Vec(4, 177), Port::INPUT, module, Kinks::LOGIC_A_INPUT)); - addInput(Port::create(Vec(31, 177), Port::INPUT, module, Kinks::LOGIC_B_INPUT)); - addOutput(Port::create(Vec(4, 214), Port::OUTPUT, module, Kinks::MAX_OUTPUT)); - addOutput(Port::create(Vec(31, 214), Port::OUTPUT, module, Kinks::MIN_OUTPUT)); - - addInput(Port::create(Vec(4, 278), Port::INPUT, module, Kinks::SH_INPUT)); - addInput(Port::create(Vec(31, 278), Port::INPUT, module, Kinks::TRIG_INPUT)); - addOutput(Port::create(Vec(4, 316), Port::OUTPUT, module, Kinks::NOISE_OUTPUT)); - addOutput(Port::create(Vec(31, 316), Port::OUTPUT, module, Kinks::SH_OUTPUT)); - - addChild(ModuleLightWidget::create>(Vec(11, 59), module, Kinks::SIGN_POS_LIGHT)); - addChild(ModuleLightWidget::create>(Vec(11, 161), module, Kinks::LOGIC_POS_LIGHT)); - addChild(ModuleLightWidget::create>(Vec(11, 262), module, Kinks::SH_POS_LIGHT)); -} +}; \ No newline at end of file diff --git a/src/Links.cpp b/src/Links.cpp index 3ab3f2a..2b7db5d 100644 --- a/src/Links.cpp +++ b/src/Links.cpp @@ -56,37 +56,30 @@ void Links::step() { } -LinksWidget::LinksWidget() { - Links *module = new Links(); - setModule(module); - box.size = Vec(15*4, 380); +struct LinksWidget : ModuleWidget { + LinksWidget(Links *module) : ModuleWidget(module) { + setPanel(SVG::load(assetPlugin(plugin, "res/Links.svg"))); - { - Panel *panel = new LightPanel(); - panel->backgroundImage = Image::load(assetPlugin(plugin, "res/Links.png")); - panel->box.size = box.size; - addChild(panel); - } - - addChild(Widget::create(Vec(15, 0))); - addChild(Widget::create(Vec(15, 365))); + addChild(Widget::create(Vec(15, 0))); + addChild(Widget::create(Vec(15, 365))); - addInput(Port::create(Vec(4, 75), Port::INPUT, module, Links::A1_INPUT)); - addOutput(Port::create(Vec(31, 75), Port::OUTPUT, module, Links::A1_OUTPUT)); - addOutput(Port::create(Vec(4, 113), Port::OUTPUT, module, Links::A2_OUTPUT)); - addOutput(Port::create(Vec(31, 113), Port::OUTPUT, module, Links::A3_OUTPUT)); + addInput(Port::create(Vec(4, 75), Port::INPUT, module, Links::A1_INPUT)); + addOutput(Port::create(Vec(31, 75), Port::OUTPUT, module, Links::A1_OUTPUT)); + addOutput(Port::create(Vec(4, 113), Port::OUTPUT, module, Links::A2_OUTPUT)); + addOutput(Port::create(Vec(31, 113), Port::OUTPUT, module, Links::A3_OUTPUT)); - addInput(Port::create(Vec(4, 177), Port::INPUT, module, Links::B1_INPUT)); - addInput(Port::create(Vec(31, 177), Port::INPUT, module, Links::B2_INPUT)); - addOutput(Port::create(Vec(4, 214), Port::OUTPUT, module, Links::B1_OUTPUT)); - addOutput(Port::create(Vec(31, 214), Port::OUTPUT, module, Links::B2_OUTPUT)); + addInput(Port::create(Vec(4, 177), Port::INPUT, module, Links::B1_INPUT)); + addInput(Port::create(Vec(31, 177), Port::INPUT, module, Links::B2_INPUT)); + addOutput(Port::create(Vec(4, 214), Port::OUTPUT, module, Links::B1_OUTPUT)); + addOutput(Port::create(Vec(31, 214), Port::OUTPUT, module, Links::B2_OUTPUT)); - addInput(Port::create(Vec(4, 278), Port::INPUT, module, Links::C1_INPUT)); - addInput(Port::create(Vec(31, 278), Port::INPUT, module, Links::C2_INPUT)); - addInput(Port::create(Vec(4, 316), Port::INPUT, module, Links::C3_INPUT)); - addOutput(Port::create(Vec(31, 316), Port::OUTPUT, module, Links::C1_OUTPUT)); + addInput(Port::create(Vec(4, 278), Port::INPUT, module, Links::C1_INPUT)); + addInput(Port::create(Vec(31, 278), Port::INPUT, module, Links::C2_INPUT)); + addInput(Port::create(Vec(4, 316), Port::INPUT, module, Links::C3_INPUT)); + addOutput(Port::create(Vec(31, 316), Port::OUTPUT, module, Links::C1_OUTPUT)); - addChild(ModuleLightWidget::create>(Vec(26, 59), module, Links::A_POS_LIGHT)); - addChild(ModuleLightWidget::create>(Vec(26, 161), module, Links::B_POS_LIGHT)); - addChild(ModuleLightWidget::create>(Vec(26, 262), module, Links::C_POS_LIGHT)); -} + addChild(ModuleLightWidget::create>(Vec(26, 59), module, Links::A_POS_LIGHT)); + addChild(ModuleLightWidget::create>(Vec(26, 161), module, Links::B_POS_LIGHT)); + addChild(ModuleLightWidget::create>(Vec(26, 262), module, Links::C_POS_LIGHT)); + } +}; \ No newline at end of file diff --git a/src/Rings.cpp b/src/Rings.cpp index 8f12628..82d7809 100644 --- a/src/Rings.cpp +++ b/src/Rings.cpp @@ -246,96 +246,84 @@ void Rings::step() { } -RingsWidget::RingsWidget() { - Rings *module = new Rings(); - setModule(module); - box.size = Vec(15*14, 380); - - { - Panel *panel = new LightPanel(); - panel->backgroundImage = Image::load(assetPlugin(plugin, "res/Rings.png")); - panel->box.size = box.size; - addChild(panel); +struct RingsWidget : ModuleWidget { + RingsWidget(Rings *module) : ModuleWidget(module) { + setPanel(SVG::load(assetPlugin(plugin, "res/Rings.svg"))); + + addChild(Widget::create(Vec(15, 0))); + addChild(Widget::create(Vec(180, 0))); + addChild(Widget::create(Vec(15, 365))); + addChild(Widget::create(Vec(180, 365))); + + addParam(ParamWidget::create(Vec(14, 40), module, Rings::POLYPHONY_PARAM, 0.0, 1.0, 0.0)); + addParam(ParamWidget::create(Vec(179, 40), module, Rings::RESONATOR_PARAM, 0.0, 1.0, 0.0)); + + addParam(ParamWidget::create(Vec(29, 72), module, Rings::FREQUENCY_PARAM, 0.0, 60.0, 30.0)); + addParam(ParamWidget::create(Vec(126, 72), module, Rings::STRUCTURE_PARAM, 0.0, 1.0, 0.5)); + + addParam(ParamWidget::create(Vec(13, 158), module, Rings::BRIGHTNESS_PARAM, 0.0, 1.0, 0.5)); + addParam(ParamWidget::create(Vec(83, 158), module, Rings::DAMPING_PARAM, 0.0, 1.0, 0.5)); + addParam(ParamWidget::create(Vec(154, 158), module, Rings::POSITION_PARAM, 0.0, 1.0, 0.5)); + + addParam(ParamWidget::create(Vec(19, 229), module, Rings::BRIGHTNESS_MOD_PARAM, -1.0, 1.0, 0.0)); + addParam(ParamWidget::create(Vec(57, 229), module, Rings::FREQUENCY_MOD_PARAM, -1.0, 1.0, 0.0)); + addParam(ParamWidget::create(Vec(96, 229), module, Rings::DAMPING_MOD_PARAM, -1.0, 1.0, 0.0)); + addParam(ParamWidget::create(Vec(134, 229), module, Rings::STRUCTURE_MOD_PARAM, -1.0, 1.0, 0.0)); + addParam(ParamWidget::create(Vec(173, 229), module, Rings::POSITION_MOD_PARAM, -1.0, 1.0, 0.0)); + + addInput(Port::create(Vec(15, 273), Port::INPUT, module, Rings::BRIGHTNESS_MOD_INPUT)); + addInput(Port::create(Vec(54, 273), Port::INPUT, module, Rings::FREQUENCY_MOD_INPUT)); + addInput(Port::create(Vec(92, 273), Port::INPUT, module, Rings::DAMPING_MOD_INPUT)); + addInput(Port::create(Vec(131, 273), Port::INPUT, module, Rings::STRUCTURE_MOD_INPUT)); + addInput(Port::create(Vec(169, 273), Port::INPUT, module, Rings::POSITION_MOD_INPUT)); + + addInput(Port::create(Vec(15, 316), Port::INPUT, module, Rings::STRUM_INPUT)); + addInput(Port::create(Vec(54, 316), Port::INPUT, module, Rings::PITCH_INPUT)); + addInput(Port::create(Vec(92, 316), Port::INPUT, module, Rings::IN_INPUT)); + addOutput(Port::create(Vec(131, 316), Port::OUTPUT, module, Rings::ODD_OUTPUT)); + addOutput(Port::create(Vec(169, 316), Port::OUTPUT, module, Rings::EVEN_OUTPUT)); + + addChild(ModuleLightWidget::create>(Vec(37, 43), module, Rings::POLYPHONY_GREEN_LIGHT)); + addChild(ModuleLightWidget::create>(Vec(162, 43), module, Rings::RESONATOR_GREEN_LIGHT)); } - addChild(Widget::create(Vec(15, 0))); - addChild(Widget::create(Vec(180, 0))); - addChild(Widget::create(Vec(15, 365))); - addChild(Widget::create(Vec(180, 365))); - - addParam(ParamWidget::create(Vec(14, 40), module, Rings::POLYPHONY_PARAM, 0.0, 1.0, 0.0)); - addParam(ParamWidget::create(Vec(179, 40), module, Rings::RESONATOR_PARAM, 0.0, 1.0, 0.0)); - - addParam(ParamWidget::create(Vec(29, 72), module, Rings::FREQUENCY_PARAM, 0.0, 60.0, 30.0)); - addParam(ParamWidget::create(Vec(126, 72), module, Rings::STRUCTURE_PARAM, 0.0, 1.0, 0.5)); - - addParam(ParamWidget::create(Vec(13, 158), module, Rings::BRIGHTNESS_PARAM, 0.0, 1.0, 0.5)); - addParam(ParamWidget::create(Vec(83, 158), module, Rings::DAMPING_PARAM, 0.0, 1.0, 0.5)); - addParam(ParamWidget::create(Vec(154, 158), module, Rings::POSITION_PARAM, 0.0, 1.0, 0.5)); - - addParam(ParamWidget::create(Vec(19, 229), module, Rings::BRIGHTNESS_MOD_PARAM, -1.0, 1.0, 0.0)); - addParam(ParamWidget::create(Vec(57, 229), module, Rings::FREQUENCY_MOD_PARAM, -1.0, 1.0, 0.0)); - addParam(ParamWidget::create(Vec(96, 229), module, Rings::DAMPING_MOD_PARAM, -1.0, 1.0, 0.0)); - addParam(ParamWidget::create(Vec(134, 229), module, Rings::STRUCTURE_MOD_PARAM, -1.0, 1.0, 0.0)); - addParam(ParamWidget::create(Vec(173, 229), module, Rings::POSITION_MOD_PARAM, -1.0, 1.0, 0.0)); - - addInput(Port::create(Vec(15, 273), Port::INPUT, module, Rings::BRIGHTNESS_MOD_INPUT)); - addInput(Port::create(Vec(54, 273), Port::INPUT, module, Rings::FREQUENCY_MOD_INPUT)); - addInput(Port::create(Vec(92, 273), Port::INPUT, module, Rings::DAMPING_MOD_INPUT)); - addInput(Port::create(Vec(131, 273), Port::INPUT, module, Rings::STRUCTURE_MOD_INPUT)); - addInput(Port::create(Vec(169, 273), Port::INPUT, module, Rings::POSITION_MOD_INPUT)); - - addInput(Port::create(Vec(15, 316), Port::INPUT, module, Rings::STRUM_INPUT)); - addInput(Port::create(Vec(54, 316), Port::INPUT, module, Rings::PITCH_INPUT)); - addInput(Port::create(Vec(92, 316), Port::INPUT, module, Rings::IN_INPUT)); - addOutput(Port::create(Vec(131, 316), Port::OUTPUT, module, Rings::ODD_OUTPUT)); - addOutput(Port::create(Vec(169, 316), Port::OUTPUT, module, Rings::EVEN_OUTPUT)); - - addChild(ModuleLightWidget::create>(Vec(37, 43), module, Rings::POLYPHONY_GREEN_LIGHT)); - addChild(ModuleLightWidget::create>(Vec(162, 43), module, Rings::RESONATOR_GREEN_LIGHT)); -} - + void appendContextMenu(Menu *menu) override { + Rings *rings = dynamic_cast(module); + assert(rings); -struct RingsModelItem : MenuItem { - Rings *rings; - rings::ResonatorModel model; - void onAction(EventAction &e) override { - rings->model = model; - } - void step() override { - rightText = (rings->model == model) ? "✔" : ""; - MenuItem::step(); - } -}; + struct RingsModelItem : MenuItem { + Rings *rings; + rings::ResonatorModel model; + void onAction(EventAction &e) override { + rings->model = model; + } + void step() override { + rightText = (rings->model == model) ? "✔" : ""; + MenuItem::step(); + } + }; -struct RingsEasterEggItem : MenuItem { - Rings *rings; - void onAction(EventAction &e) override { - rings->easterEgg = !rings->easterEgg; - } - void step() override { - rightText = (rings->easterEgg) ? "✔" : ""; - MenuItem::step(); + struct RingsEasterEggItem : MenuItem { + Rings *rings; + void onAction(EventAction &e) override { + rings->easterEgg = !rings->easterEgg; + } + void step() override { + rightText = (rings->easterEgg) ? "✔" : ""; + MenuItem::step(); + } + }; + + menu->addChild(construct()); + menu->addChild(construct(&MenuLabel::text, "Resonator")); + menu->addChild(construct(&MenuItem::text, "Modal resonator", &RingsModelItem::rings, rings, &RingsModelItem::model, rings::RESONATOR_MODEL_MODAL)); + menu->addChild(construct(&MenuItem::text, "Sympathetic strings", &RingsModelItem::rings, rings, &RingsModelItem::model, rings::RESONATOR_MODEL_SYMPATHETIC_STRING)); + menu->addChild(construct(&MenuItem::text, "Modulated/inharmonic string", &RingsModelItem::rings, rings, &RingsModelItem::model, rings::RESONATOR_MODEL_STRING)); + menu->addChild(construct(&MenuItem::text, "FM voice", &RingsModelItem::rings, rings, &RingsModelItem::model, rings::RESONATOR_MODEL_FM_VOICE)); + menu->addChild(construct(&MenuItem::text, "Quantized sympathetic strings", &RingsModelItem::rings, rings, &RingsModelItem::model, rings::RESONATOR_MODEL_SYMPATHETIC_STRING_QUANTIZED)); + menu->addChild(construct(&MenuItem::text, "Reverb string", &RingsModelItem::rings, rings, &RingsModelItem::model, rings::RESONATOR_MODEL_STRING_AND_REVERB)); + + menu->addChild(construct()); + menu->addChild(construct(&MenuItem::text, "Disastrous Peace", &RingsEasterEggItem::rings, rings)); } }; - -Menu *RingsWidget::createContextMenu() { - Menu *menu = ModuleWidget::createContextMenu(); - - Rings *rings = dynamic_cast(module); - assert(rings); - - menu->addChild(construct()); - menu->addChild(construct(&MenuLabel::text, "Resonator")); - menu->addChild(construct(&MenuEntry::text, "Modal resonator", &RingsModelItem::rings, rings, &RingsModelItem::model, rings::RESONATOR_MODEL_MODAL)); - menu->addChild(construct(&MenuEntry::text, "Sympathetic strings", &RingsModelItem::rings, rings, &RingsModelItem::model, rings::RESONATOR_MODEL_SYMPATHETIC_STRING)); - menu->addChild(construct(&MenuEntry::text, "Modulated/inharmonic string", &RingsModelItem::rings, rings, &RingsModelItem::model, rings::RESONATOR_MODEL_STRING)); - menu->addChild(construct(&MenuEntry::text, "FM voice", &RingsModelItem::rings, rings, &RingsModelItem::model, rings::RESONATOR_MODEL_FM_VOICE)); - menu->addChild(construct(&MenuEntry::text, "Quantized sympathetic strings", &RingsModelItem::rings, rings, &RingsModelItem::model, rings::RESONATOR_MODEL_SYMPATHETIC_STRING_QUANTIZED)); - menu->addChild(construct(&MenuEntry::text, "Reverb string", &RingsModelItem::rings, rings, &RingsModelItem::model, rings::RESONATOR_MODEL_STRING_AND_REVERB)); - - menu->addChild(construct()); - menu->addChild(construct(&MenuEntry::text, "Disastrous Peace", &RingsEasterEggItem::rings, rings)); - - return menu; -} \ No newline at end of file diff --git a/src/Shades.cpp b/src/Shades.cpp index f8157aa..7bb100c 100644 --- a/src/Shades.cpp +++ b/src/Shades.cpp @@ -60,38 +60,31 @@ void Shades::step() { } -ShadesWidget::ShadesWidget() { - Shades *module = new Shades(); - setModule(module); - box.size = Vec(15*6, 380); +struct ShadesWidget : ModuleWidget { + ShadesWidget(Shades *module) : ModuleWidget(module) { + setPanel(SVG::load(assetPlugin(plugin, "res/Shades.svg"))); - { - Panel *panel = new LightPanel(); - panel->backgroundImage = Image::load(assetPlugin(plugin, "res/Shades.png")); - panel->box.size = box.size; - addChild(panel); - } - - addChild(Widget::create(Vec(15, 0))); - addChild(Widget::create(Vec(15, 365))); + addChild(Widget::create(Vec(15, 0))); + addChild(Widget::create(Vec(15, 365))); - addParam(ParamWidget::create(Vec(40, 40), module, Shades::GAIN1_PARAM, 0.0, 1.0, 0.5)); - addParam(ParamWidget::create(Vec(40, 106), module, Shades::GAIN2_PARAM, 0.0, 1.0, 0.5)); - addParam(ParamWidget::create(Vec(40, 172), module, Shades::GAIN3_PARAM, 0.0, 1.0, 0.5)); + addParam(ParamWidget::create(Vec(40, 40), module, Shades::GAIN1_PARAM, 0.0, 1.0, 0.5)); + addParam(ParamWidget::create(Vec(40, 106), module, Shades::GAIN2_PARAM, 0.0, 1.0, 0.5)); + addParam(ParamWidget::create(Vec(40, 172), module, Shades::GAIN3_PARAM, 0.0, 1.0, 0.5)); - addParam(ParamWidget::create(Vec(10, 51), module, Shades::MODE1_PARAM, 0.0, 1.0, 1.0)); - addParam(ParamWidget::create(Vec(10, 117), module, Shades::MODE2_PARAM, 0.0, 1.0, 1.0)); - addParam(ParamWidget::create(Vec(10, 183), module, Shades::MODE3_PARAM, 0.0, 1.0, 1.0)); + addParam(ParamWidget::create(Vec(10, 51), module, Shades::MODE1_PARAM, 0.0, 1.0, 1.0)); + addParam(ParamWidget::create(Vec(10, 117), module, Shades::MODE2_PARAM, 0.0, 1.0, 1.0)); + addParam(ParamWidget::create(Vec(10, 183), module, Shades::MODE3_PARAM, 0.0, 1.0, 1.0)); - addInput(Port::create(Vec(9, 245), Port::INPUT, module, Shades::IN1_INPUT)); - addInput(Port::create(Vec(9, 281), Port::INPUT, module, Shades::IN2_INPUT)); - addInput(Port::create(Vec(9, 317), Port::INPUT, module, Shades::IN3_INPUT)); + addInput(Port::create(Vec(9, 245), Port::INPUT, module, Shades::IN1_INPUT)); + addInput(Port::create(Vec(9, 281), Port::INPUT, module, Shades::IN2_INPUT)); + addInput(Port::create(Vec(9, 317), Port::INPUT, module, Shades::IN3_INPUT)); - addOutput(Port::create(Vec(56, 245), Port::OUTPUT, module, Shades::OUT1_OUTPUT)); - addOutput(Port::create(Vec(56, 281), Port::OUTPUT, module, Shades::OUT2_OUTPUT)); - addOutput(Port::create(Vec(56, 317), Port::OUTPUT, module, Shades::OUT3_OUTPUT)); + addOutput(Port::create(Vec(56, 245), Port::OUTPUT, module, Shades::OUT1_OUTPUT)); + addOutput(Port::create(Vec(56, 281), Port::OUTPUT, module, Shades::OUT2_OUTPUT)); + addOutput(Port::create(Vec(56, 317), Port::OUTPUT, module, Shades::OUT3_OUTPUT)); - addChild(ModuleLightWidget::create>(Vec(41, 254), module, Shades::OUT1_POS_LIGHT)); - addChild(ModuleLightWidget::create>(Vec(41, 290), module, Shades::OUT2_POS_LIGHT)); - addChild(ModuleLightWidget::create>(Vec(41, 326), module, Shades::OUT3_POS_LIGHT)); -} + addChild(ModuleLightWidget::create>(Vec(41, 254), module, Shades::OUT1_POS_LIGHT)); + addChild(ModuleLightWidget::create>(Vec(41, 290), module, Shades::OUT2_POS_LIGHT)); + addChild(ModuleLightWidget::create>(Vec(41, 326), module, Shades::OUT3_POS_LIGHT)); + } +}; \ No newline at end of file diff --git a/src/Streams.cpp b/src/Streams.cpp deleted file mode 100644 index e6b3988..0000000 --- a/src/Streams.cpp +++ /dev/null @@ -1,79 +0,0 @@ -#include -#include "AudibleInstruments.hpp" - - -struct Streams : Module { - enum ParamIds { - SHAPE1_PARAM, - MOD1_PARAM, - LEVEL1_PARAM, - RESPONSE1_PARAM, - - SHAPE2_PARAM, - MOD2_PARAM, - LEVEL2_PARAM, - RESPONSE2_PARAM, - NUM_PARAMS - }; - enum InputIds { - EXCITE1_INPUT, - IN1_INPUT, - LEVEL1_INPUT, - - EXCITE2_INPUT, - IN2_INPUT, - LEVEL2_INPUT, - NUM_INPUTS - }; - enum OutputIds { - OUT1_OUTPUT, - OUT2_OUTPUT, - NUM_OUTPUTS - }; - - Streams() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS) {} - void step() override; -}; - - -void Streams::step() { -} - - -StreamsWidget::StreamsWidget() { - Streams *module = new Streams(); - setModule(module); - box.size = Vec(15*12, 380); - - { - Panel *panel = new LightPanel(); - panel->backgroundImage = Image::load(assetPlugin(plugin, "res/Streams.png")); - panel->box.size = box.size; - addChild(panel); - } - - addChild(Widget::create(Vec(15, 0))); - addChild(Widget::create(Vec(150, 0))); - addChild(Widget::create(Vec(15, 365))); - addChild(Widget::create(Vec(150, 365))); - - // addParam(ParamWidget::create(Vec(30, 53), module, Streams::ALGORITHM_PARAM, 0.0, 8.0, 0.0)); - - // addParam(ParamWidget::create(Vec(95, 173), module, Streams::TIMBRE_PARAM, 0.0, 1.0, 0.5)); - // addParam(ParamWidget::create(Vec(17, 182), module, Streams::STATE_PARAM, 0.0, 3.0, 0.0)); - // addParam(ParamWidget::create(Vec(15, 214), module, Streams::LEVEL1_PARAM, 0.0, 1.0, 1.0)); - // addParam(ParamWidget::create(Vec(53, 214), module, Streams::LEVEL2_PARAM, 0.0, 1.0, 1.0)); - - // addInput(Port::create(Vec(11, 275), Port::INPUT, module, Streams::LEVEL1_INPUT)); - // addInput(Port::create(Vec(47, 275), Port::INPUT, module, Streams::LEVEL2_INPUT)); - // addInput(Port::create(Vec(83, 275), Port::INPUT, module, Streams::ALGORITHM_INPUT)); - // addInput(Port::create(Vec(119, 275), Port::INPUT, module, Streams::TIMBRE_INPUT)); - - // addInput(Port::create(Vec(11, 318), Port::INPUT, module, Streams::CARRIER_INPUT)); - // addInput(Port::create(Vec(47, 318), Port::INPUT, module, Streams::MODULATOR_INPUT)); - // addOutput(Port::create(Vec(83, 318), Port::OUTPUT, module, Streams::MODULATOR_OUTPUT)); - // addOutput(Port::create(Vec(119, 318), Port::OUTPUT, module, Streams::AUX_OUTPUT)); - - // Streams *streams = dynamic_cast(module); - // addChild(createValueLight(Vec(21, 168), &streams->lights[0])); -} diff --git a/src/Tides.cpp b/src/Tides.cpp index 6cf3bd3..bcb4f32 100644 --- a/src/Tides.cpp +++ b/src/Tides.cpp @@ -192,91 +192,88 @@ void Tides::step() { } -TidesWidget::TidesWidget() { - Tides *module = new Tides(); - setModule(module); - box.size = Vec(15 * 14, 380); - - { - tidesPanel = new LightPanel(); - tidesPanel->backgroundImage = Image::load(assetPlugin(plugin, "res/Tides.png")); - tidesPanel->box.size = box.size; - addChild(tidesPanel); +struct TidesSheepItem : MenuItem { + Tides *tides; + void onAction(EventAction &e) override { + tides->sheep ^= true; } - { - sheepPanel = new LightPanel(); - sheepPanel->backgroundImage = Image::load(assetPlugin(plugin, "res/Sheep.png")); - sheepPanel->box.size = box.size; - addChild(sheepPanel); + void step() override { + rightText = (tides->sheep) ? "✔" : ""; + MenuItem::step(); } +}; - addChild(Widget::create(Vec(15, 0))); - addChild(Widget::create(Vec(180, 0))); - addChild(Widget::create(Vec(15, 365))); - addChild(Widget::create(Vec(180, 365))); - - addParam(ParamWidget::create(Vec(19, 52), module, Tides::MODE_PARAM, 0.0, 1.0, 0.0)); - addParam(ParamWidget::create(Vec(19, 93), module, Tides::RANGE_PARAM, 0.0, 1.0, 0.0)); - - addParam(ParamWidget::create(Vec(78, 60), module, Tides::FREQUENCY_PARAM, -48.0, 48.0, 0.0)); - addParam(ParamWidget::create(Vec(156, 66), module, Tides::FM_PARAM, -12.0, 12.0, 0.0)); - addParam(ParamWidget::create(Vec(13, 155), module, Tides::SHAPE_PARAM, -1.0, 1.0, 0.0)); - addParam(ParamWidget::create(Vec(85, 155), module, Tides::SLOPE_PARAM, -1.0, 1.0, 0.0)); - addParam(ParamWidget::create(Vec(156, 155), module, Tides::SMOOTHNESS_PARAM, -1.0, 1.0, 0.0)); +struct TidesWidget : ModuleWidget { + Panel *tidesPanel; + Panel *sheepPanel; - addInput(Port::create(Vec(21, 219), Port::INPUT, module, Tides::SHAPE_INPUT)); - addInput(Port::create(Vec(93, 219), Port::INPUT, module, Tides::SLOPE_INPUT)); - addInput(Port::create(Vec(164, 219), Port::INPUT, module, Tides::SMOOTHNESS_INPUT)); + TidesWidget(Tides *module) : ModuleWidget(module) { + { + tidesPanel = new LightPanel(); + tidesPanel->backgroundImage = Image::load(assetPlugin(plugin, "res/Tides.png")); + tidesPanel->box.size = box.size; + addChild(tidesPanel); + } + { + sheepPanel = new LightPanel(); + sheepPanel->backgroundImage = Image::load(assetPlugin(plugin, "res/Sheep.png")); + sheepPanel->box.size = box.size; + addChild(sheepPanel); + } - addInput(Port::create(Vec(21, 274), Port::INPUT, module, Tides::TRIG_INPUT)); - addInput(Port::create(Vec(57, 274), Port::INPUT, module, Tides::FREEZE_INPUT)); - addInput(Port::create(Vec(93, 274), Port::INPUT, module, Tides::PITCH_INPUT)); - addInput(Port::create(Vec(128, 274), Port::INPUT, module, Tides::FM_INPUT)); - addInput(Port::create(Vec(164, 274), Port::INPUT, module, Tides::LEVEL_INPUT)); + addChild(Widget::create(Vec(15, 0))); + addChild(Widget::create(Vec(180, 0))); + addChild(Widget::create(Vec(15, 365))); + addChild(Widget::create(Vec(180, 365))); - addInput(Port::create(Vec(21, 316), Port::INPUT, module, Tides::CLOCK_INPUT)); - addOutput(Port::create(Vec(57, 316), Port::OUTPUT, module, Tides::HIGH_OUTPUT)); - addOutput(Port::create(Vec(93, 316), Port::OUTPUT, module, Tides::LOW_OUTPUT)); - addOutput(Port::create(Vec(128, 316), Port::OUTPUT, module, Tides::UNI_OUTPUT)); - addOutput(Port::create(Vec(164, 316), Port::OUTPUT, module, Tides::BI_OUTPUT)); + addParam(ParamWidget::create(Vec(19, 52), module, Tides::MODE_PARAM, 0.0, 1.0, 0.0)); + addParam(ParamWidget::create(Vec(19, 93), module, Tides::RANGE_PARAM, 0.0, 1.0, 0.0)); - addChild(ModuleLightWidget::create>(Vec(56, 61), module, Tides::MODE_GREEN_LIGHT)); - addChild(ModuleLightWidget::create>(Vec(56, 82), module, Tides::PHASE_GREEN_LIGHT)); - addChild(ModuleLightWidget::create>(Vec(56, 102), module, Tides::RANGE_GREEN_LIGHT)); -} + addParam(ParamWidget::create(Vec(78, 60), module, Tides::FREQUENCY_PARAM, -48.0, 48.0, 0.0)); + addParam(ParamWidget::create(Vec(156, 66), module, Tides::FM_PARAM, -12.0, 12.0, 0.0)); -void TidesWidget::step() { - Tides *tides = dynamic_cast(module); - assert(tides); + addParam(ParamWidget::create(Vec(13, 155), module, Tides::SHAPE_PARAM, -1.0, 1.0, 0.0)); + addParam(ParamWidget::create(Vec(85, 155), module, Tides::SLOPE_PARAM, -1.0, 1.0, 0.0)); + addParam(ParamWidget::create(Vec(156, 155), module, Tides::SMOOTHNESS_PARAM, -1.0, 1.0, 0.0)); - tidesPanel->visible = !tides->sheep; - sheepPanel->visible = tides->sheep; + addInput(Port::create(Vec(21, 219), Port::INPUT, module, Tides::SHAPE_INPUT)); + addInput(Port::create(Vec(93, 219), Port::INPUT, module, Tides::SLOPE_INPUT)); + addInput(Port::create(Vec(164, 219), Port::INPUT, module, Tides::SMOOTHNESS_INPUT)); - ModuleWidget::step(); -} + addInput(Port::create(Vec(21, 274), Port::INPUT, module, Tides::TRIG_INPUT)); + addInput(Port::create(Vec(57, 274), Port::INPUT, module, Tides::FREEZE_INPUT)); + addInput(Port::create(Vec(93, 274), Port::INPUT, module, Tides::PITCH_INPUT)); + addInput(Port::create(Vec(128, 274), Port::INPUT, module, Tides::FM_INPUT)); + addInput(Port::create(Vec(164, 274), Port::INPUT, module, Tides::LEVEL_INPUT)); + addInput(Port::create(Vec(21, 316), Port::INPUT, module, Tides::CLOCK_INPUT)); + addOutput(Port::create(Vec(57, 316), Port::OUTPUT, module, Tides::HIGH_OUTPUT)); + addOutput(Port::create(Vec(93, 316), Port::OUTPUT, module, Tides::LOW_OUTPUT)); + addOutput(Port::create(Vec(128, 316), Port::OUTPUT, module, Tides::UNI_OUTPUT)); + addOutput(Port::create(Vec(164, 316), Port::OUTPUT, module, Tides::BI_OUTPUT)); -struct TidesSheepItem : MenuItem { - Tides *tides; - void onAction(EventAction &e) override { - tides->sheep ^= true; + addChild(ModuleLightWidget::create>(Vec(56, 61), module, Tides::MODE_GREEN_LIGHT)); + addChild(ModuleLightWidget::create>(Vec(56, 82), module, Tides::PHASE_GREEN_LIGHT)); + addChild(ModuleLightWidget::create>(Vec(56, 102), module, Tides::RANGE_GREEN_LIGHT)); } + void step() override { - rightText = (tides->sheep) ? "✔" : ""; - MenuItem::step(); - } -}; + Tides *tides = dynamic_cast(module); + assert(tides); + tidesPanel->visible = !tides->sheep; + sheepPanel->visible = tides->sheep; -Menu *TidesWidget::createContextMenu() { - Menu *menu = ModuleWidget::createContextMenu(); + ModuleWidget::step(); + } - Tides *tides = dynamic_cast(module); - assert(tides); - menu->addChild(construct()); - menu->addChild(construct(&MenuEntry::text, "Sheep", &TidesSheepItem::tides, tides)); + void appendContextMenu(Menu *menu) override { + Tides *tides = dynamic_cast(module); + assert(tides); - return menu; -} + menu->addChild(construct()); + menu->addChild(construct(&MenuItem::text, "Sheep", &TidesSheepItem::tides, tides)); + } +}; \ No newline at end of file diff --git a/src/Veils.cpp b/src/Veils.cpp index eb1932a..1062ff1 100644 --- a/src/Veils.cpp +++ b/src/Veils.cpp @@ -68,50 +68,43 @@ void Veils::step() { } -VeilsWidget::VeilsWidget() { - Veils *module = new Veils(); - setModule(module); - box.size = Vec(15*12, 380); - - { - Panel *panel = new LightPanel(); - panel->backgroundImage = Image::load(assetPlugin(plugin, "res/Veils.png")); - panel->box.size = box.size; - addChild(panel); +struct VeilsWidget : ModuleWidget { + VeilsWidget(Veils *module) : ModuleWidget(module) { + setPanel(SVG::load(assetPlugin(plugin, "res/Veils.svg"))); + + addChild(Widget::create(Vec(15, 0))); + addChild(Widget::create(Vec(150, 0))); + addChild(Widget::create(Vec(15, 365))); + addChild(Widget::create(Vec(150, 365))); + + addParam(ParamWidget::create(Vec(8, 52), module, Veils::GAIN1_PARAM, 0.0, 1.0, 0.0)); + addParam(ParamWidget::create(Vec(8, 131), module, Veils::GAIN2_PARAM, 0.0, 1.0, 0.0)); + addParam(ParamWidget::create(Vec(8, 210), module, Veils::GAIN3_PARAM, 0.0, 1.0, 0.0)); + addParam(ParamWidget::create(Vec(8, 288), module, Veils::GAIN4_PARAM, 0.0, 1.0, 0.0)); + + addParam(ParamWidget::create(Vec(72, 56), module, Veils::RESPONSE1_PARAM, 0.0, 1.0, 1.0)); + addParam(ParamWidget::create(Vec(72, 135), module, Veils::RESPONSE2_PARAM, 0.0, 1.0, 1.0)); + addParam(ParamWidget::create(Vec(72, 214), module, Veils::RESPONSE3_PARAM, 0.0, 1.0, 1.0)); + addParam(ParamWidget::create(Vec(72, 292), module, Veils::RESPONSE4_PARAM, 0.0, 1.0, 1.0)); + + addInput(Port::create(Vec(110, 41), Port::INPUT, module, Veils::IN1_INPUT)); + addInput(Port::create(Vec(110, 120), Port::INPUT, module, Veils::IN2_INPUT)); + addInput(Port::create(Vec(110, 198), Port::INPUT, module, Veils::IN3_INPUT)); + addInput(Port::create(Vec(110, 277), Port::INPUT, module, Veils::IN4_INPUT)); + + addInput(Port::create(Vec(110, 80), Port::INPUT, module, Veils::CV1_INPUT)); + addInput(Port::create(Vec(110, 159), Port::INPUT, module, Veils::CV2_INPUT)); + addInput(Port::create(Vec(110, 238), Port::INPUT, module, Veils::CV3_INPUT)); + addInput(Port::create(Vec(110, 316), Port::INPUT, module, Veils::CV4_INPUT)); + + addOutput(Port::create(Vec(144, 41), Port::OUTPUT, module, Veils::OUT1_OUTPUT)); + addOutput(Port::create(Vec(144, 120), Port::OUTPUT, module, Veils::OUT2_OUTPUT)); + addOutput(Port::create(Vec(144, 198), Port::OUTPUT, module, Veils::OUT3_OUTPUT)); + addOutput(Port::create(Vec(144, 277), Port::OUTPUT, module, Veils::OUT4_OUTPUT)); + + addChild(ModuleLightWidget::create>(Vec(150, 87), module, Veils::OUT1_POS_LIGHT)); + addChild(ModuleLightWidget::create>(Vec(150, 166), module, Veils::OUT2_POS_LIGHT)); + addChild(ModuleLightWidget::create>(Vec(150, 245), module, Veils::OUT3_POS_LIGHT)); + addChild(ModuleLightWidget::create>(Vec(150, 324), module, Veils::OUT4_POS_LIGHT)); } - - addChild(Widget::create(Vec(15, 0))); - addChild(Widget::create(Vec(150, 0))); - addChild(Widget::create(Vec(15, 365))); - addChild(Widget::create(Vec(150, 365))); - - addParam(ParamWidget::create(Vec(8, 52), module, Veils::GAIN1_PARAM, 0.0, 1.0, 0.0)); - addParam(ParamWidget::create(Vec(8, 131), module, Veils::GAIN2_PARAM, 0.0, 1.0, 0.0)); - addParam(ParamWidget::create(Vec(8, 210), module, Veils::GAIN3_PARAM, 0.0, 1.0, 0.0)); - addParam(ParamWidget::create(Vec(8, 288), module, Veils::GAIN4_PARAM, 0.0, 1.0, 0.0)); - - addParam(ParamWidget::create(Vec(72, 56), module, Veils::RESPONSE1_PARAM, 0.0, 1.0, 1.0)); - addParam(ParamWidget::create(Vec(72, 135), module, Veils::RESPONSE2_PARAM, 0.0, 1.0, 1.0)); - addParam(ParamWidget::create(Vec(72, 214), module, Veils::RESPONSE3_PARAM, 0.0, 1.0, 1.0)); - addParam(ParamWidget::create(Vec(72, 292), module, Veils::RESPONSE4_PARAM, 0.0, 1.0, 1.0)); - - addInput(Port::create(Vec(110, 41), Port::INPUT, module, Veils::IN1_INPUT)); - addInput(Port::create(Vec(110, 120), Port::INPUT, module, Veils::IN2_INPUT)); - addInput(Port::create(Vec(110, 198), Port::INPUT, module, Veils::IN3_INPUT)); - addInput(Port::create(Vec(110, 277), Port::INPUT, module, Veils::IN4_INPUT)); - - addInput(Port::create(Vec(110, 80), Port::INPUT, module, Veils::CV1_INPUT)); - addInput(Port::create(Vec(110, 159), Port::INPUT, module, Veils::CV2_INPUT)); - addInput(Port::create(Vec(110, 238), Port::INPUT, module, Veils::CV3_INPUT)); - addInput(Port::create(Vec(110, 316), Port::INPUT, module, Veils::CV4_INPUT)); - - addOutput(Port::create(Vec(144, 41), Port::OUTPUT, module, Veils::OUT1_OUTPUT)); - addOutput(Port::create(Vec(144, 120), Port::OUTPUT, module, Veils::OUT2_OUTPUT)); - addOutput(Port::create(Vec(144, 198), Port::OUTPUT, module, Veils::OUT3_OUTPUT)); - addOutput(Port::create(Vec(144, 277), Port::OUTPUT, module, Veils::OUT4_OUTPUT)); - - addChild(ModuleLightWidget::create>(Vec(150, 87), module, Veils::OUT1_POS_LIGHT)); - addChild(ModuleLightWidget::create>(Vec(150, 166), module, Veils::OUT2_POS_LIGHT)); - addChild(ModuleLightWidget::create>(Vec(150, 245), module, Veils::OUT3_POS_LIGHT)); - addChild(ModuleLightWidget::create>(Vec(150, 324), module, Veils::OUT4_POS_LIGHT)); -} +}; \ No newline at end of file diff --git a/src/Warps.cpp b/src/Warps.cpp index 1c942c4..fa7afd8 100644 --- a/src/Warps.cpp +++ b/src/Warps.cpp @@ -119,46 +119,41 @@ void Warps::step() { } -WarpsWidget::WarpsWidget() { - Warps *module = new Warps(); - setModule(module); - box.size = Vec(15*10, 380); - - { - Panel *panel = new LightPanel(); - panel->backgroundImage = Image::load(assetPlugin(plugin, "res/Warps.png")); - panel->box.size = box.size; - addChild(panel); +struct AlgorithmLight : RedGreenBlueLight { + AlgorithmLight() { + box.size = Vec(71, 71); } +}; - addChild(Widget::create(Vec(15, 0))); - addChild(Widget::create(Vec(120, 0))); - addChild(Widget::create(Vec(15, 365))); - addChild(Widget::create(Vec(120, 365))); - addParam(ParamWidget::create(Vec(29, 52), module, Warps::ALGORITHM_PARAM, 0.0, 8.0, 0.0)); +struct WarpsWidget : ModuleWidget { + WarpsWidget(Warps *module) : ModuleWidget(module) { + setPanel(SVG::load(assetPlugin(plugin, "res/Warps.svg"))); - addParam(ParamWidget::create(Vec(94, 173), module, Warps::TIMBRE_PARAM, 0.0, 1.0, 0.5)); - addParam(ParamWidget::create(Vec(16, 182), module, Warps::STATE_PARAM, 0.0, 1.0, 0.0)); - addParam(ParamWidget::create(Vec(14, 213), module, Warps::LEVEL1_PARAM, 0.0, 1.0, 1.0)); - addParam(ParamWidget::create(Vec(53, 213), module, Warps::LEVEL2_PARAM, 0.0, 1.0, 1.0)); + addChild(Widget::create(Vec(15, 0))); + addChild(Widget::create(Vec(120, 0))); + addChild(Widget::create(Vec(15, 365))); + addChild(Widget::create(Vec(120, 365))); - addInput(Port::create(Vec(8, 273), Port::INPUT, module, Warps::LEVEL1_INPUT)); - addInput(Port::create(Vec(44, 273), Port::INPUT, module, Warps::LEVEL2_INPUT)); - addInput(Port::create(Vec(80, 273), Port::INPUT, module, Warps::ALGORITHM_INPUT)); - addInput(Port::create(Vec(116, 273), Port::INPUT, module, Warps::TIMBRE_INPUT)); + addParam(ParamWidget::create(Vec(29, 52), module, Warps::ALGORITHM_PARAM, 0.0, 8.0, 0.0)); - addInput(Port::create(Vec(8, 316), Port::INPUT, module, Warps::CARRIER_INPUT)); - addInput(Port::create(Vec(44, 316), Port::INPUT, module, Warps::MODULATOR_INPUT)); - addOutput(Port::create(Vec(80, 316), Port::OUTPUT, module, Warps::MODULATOR_OUTPUT)); - addOutput(Port::create(Vec(116, 316), Port::OUTPUT, module, Warps::AUX_OUTPUT)); + addParam(ParamWidget::create(Vec(94, 173), module, Warps::TIMBRE_PARAM, 0.0, 1.0, 0.5)); + addParam(ParamWidget::create(Vec(16, 182), module, Warps::STATE_PARAM, 0.0, 1.0, 0.0)); + addParam(ParamWidget::create(Vec(14, 213), module, Warps::LEVEL1_PARAM, 0.0, 1.0, 1.0)); + addParam(ParamWidget::create(Vec(53, 213), module, Warps::LEVEL2_PARAM, 0.0, 1.0, 1.0)); - addChild(ModuleLightWidget::create>(Vec(20, 167), module, Warps::CARRIER_GREEN_LIGHT)); + addInput(Port::create(Vec(8, 273), Port::INPUT, module, Warps::LEVEL1_INPUT)); + addInput(Port::create(Vec(44, 273), Port::INPUT, module, Warps::LEVEL2_INPUT)); + addInput(Port::create(Vec(80, 273), Port::INPUT, module, Warps::ALGORITHM_INPUT)); + addInput(Port::create(Vec(116, 273), Port::INPUT, module, Warps::TIMBRE_INPUT)); - struct AlgorithmLight : RedGreenBlueLight { - AlgorithmLight() { - box.size = Vec(71, 71); - } - }; - addChild(ModuleLightWidget::create(Vec(40, 63), module, Warps::ALGORITHM_LIGHT)); -} + addInput(Port::create(Vec(8, 316), Port::INPUT, module, Warps::CARRIER_INPUT)); + addInput(Port::create(Vec(44, 316), Port::INPUT, module, Warps::MODULATOR_INPUT)); + addOutput(Port::create(Vec(80, 316), Port::OUTPUT, module, Warps::MODULATOR_OUTPUT)); + addOutput(Port::create(Vec(116, 316), Port::OUTPUT, module, Warps::AUX_OUTPUT)); + + addChild(ModuleLightWidget::create>(Vec(20, 167), module, Warps::CARRIER_GREEN_LIGHT)); + + addChild(ModuleLightWidget::create(Vec(40, 63), module, Warps::ALGORITHM_LIGHT)); + } +}; \ No newline at end of file