From d27e78a3b0ad6a6b7875cb46c401225cd3011f70 Mon Sep 17 00:00:00 2001 From: Leonardo Date: Wed, 10 Jan 2018 23:34:57 +0100 Subject: [PATCH 1/2] Fixes small warnings --- src/JWModules.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/JWModules.hpp b/src/JWModules.hpp index 881c8ea..659d277 100644 --- a/src/JWModules.hpp +++ b/src/JWModules.hpp @@ -311,7 +311,7 @@ struct BouncyBallsWidget : ModuleWidget { struct WavHeadWidget : ModuleWidget { WavHeadWidget(); - void step(); + void step() override; Widget* widgetToMove; Widget* snowflakesArr[10]; Menu *createContextMenu() override; @@ -327,9 +327,9 @@ struct FullScopeWidget : ModuleWidget { Widget *rightHandle; TransparentWidget *display; FullScopeWidget(); - void step(); - json_t *toJson(); - void fromJson(json_t *rootJ); + void step() override; + json_t *toJson() override; + void fromJson(json_t *rootJ) override; Menu *createContextMenu() override; }; From 4f3c8841c10ed35ce3adc11649076c1751d3e64f Mon Sep 17 00:00:00 2001 From: Leonardo Date: Wed, 10 Jan 2018 23:35:24 +0100 Subject: [PATCH 2/2] Fixes the angle representation to match what Caudal outputs --- src/ThingThing.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/ThingThing.cpp b/src/ThingThing.cpp index 965ca94..606d627 100644 --- a/src/ThingThing.cpp +++ b/src/ThingThing.cpp @@ -72,20 +72,27 @@ struct ThingThingDisplay : Widget { ballRadius += rescalef(module->inputs[ThingThing::ZOOM_MULT_INPUT].value, -5.0, 5.0, 1.0, 50.0); } + float x[5]; + float y[5]; + float angle[5]; + + for(int i=0; i<5; i++){ + angle[i] = i==0 ? 0 : (module->inputs[ThingThing::ANG_INPUT+i].value + angle[i-1]) * module->atten[i]; + x[i] = i==0 ? 0 : sinf(rescalef(angle[i], -5, 5, -2*M_PI + M_PI/2.0f, 2*M_PI + M_PI/2.0f)) * zoom; + y[i] = i==0 ? 0 : cosf(rescalef(angle[i], -5, 5, -2*M_PI + M_PI/2.0f, 2*M_PI + M_PI/2.0f)) * zoom; + } + /////////////////////// LINES /////////////////////// nvgSave(vg); nvgTranslate(vg, box.size.x * 0.5, box.size.y * 0.5); for(int i=0; i<5; i++){ - float angle = module->inputs[ThingThing::ANG_INPUT+i].value * module->atten[i]; - float x = i==0 ? 0 : sinf(rescalef(angle, -5, 5, -2*M_PI, 2*M_PI)) * zoom; - float y = i==0 ? 0 : cosf(rescalef(angle, -5, 5, -2*M_PI, 2*M_PI)) * zoom; - nvgTranslate(vg, x, y); + nvgTranslate(vg, x[i], y[i]); nvgStrokeColor(vg, nvgRGB(255, 255, 255)); if(i>0){ nvgStrokeWidth(vg, 1); nvgBeginPath(vg); nvgMoveTo(vg, 0, 0); - nvgLineTo(vg, -x, -y); + nvgLineTo(vg, -x[i], -y[i]); nvgStroke(vg); } } @@ -95,10 +102,7 @@ struct ThingThingDisplay : Widget { nvgSave(vg); nvgTranslate(vg, box.size.x * 0.5, box.size.y * 0.5); for(int i=0; i<5; i++){ - float angle = module->inputs[ThingThing::ANG_INPUT+i].value * module->atten[i]; - float x = i==0 ? 0 : sinf(rescalef(angle, -5, 5, -2*M_PI, 2*M_PI)) * zoom; - float y = i==0 ? 0 : cosf(rescalef(angle, -5, 5, -2*M_PI, 2*M_PI)) * zoom; - nvgTranslate(vg, x, y); + nvgTranslate(vg, x[i], y[i]); nvgStrokeColor(vg, module->balls[i].color); nvgFillColor(vg, module->balls[i].color); nvgStrokeWidth(vg, 2);