diff --git a/include/components.hpp b/include/components.hpp index 306e0b9f..1ccfa1af 100644 --- a/include/components.hpp +++ b/include/components.hpp @@ -337,7 +337,6 @@ struct Rogan1PWhite : Rogan1P { struct SynthTechAlco : SVGKnob { SynthTechAlco() { - box.size = Vec(45, 45); minAngle = -0.82*M_PI; maxAngle = 0.82*M_PI; setSVG(SVG::load(assetGlobal("res/ComponentLibrary/SynthTechAlco.svg"))); diff --git a/include/engine.hpp b/include/engine.hpp index cfff9b1d..b4220e6a 100644 --- a/include/engine.hpp +++ b/include/engine.hpp @@ -32,6 +32,9 @@ struct Output { struct Light { /** The square of the brightness value */ float value = 0.0; + void setBrightness(float brightness) { + value = brightness * brightness; + } void setBrightnessSmooth(float brightness); }; diff --git a/include/rack.hpp b/include/rack.hpp index 93ebaf53..7a079bfe 100644 --- a/include/rack.hpp +++ b/include/rack.hpp @@ -2,12 +2,12 @@ #include "util.hpp" #include "math.hpp" +#include "asset.hpp" #include "plugin.hpp" #include "engine.hpp" #include "gui.hpp" #include "app.hpp" #include "components.hpp" -#include "asset.hpp" namespace rack { @@ -80,5 +80,14 @@ ValueLight *createValueLight(Vec pos, float *value) { return light; } +/** Polyfill for future LightWidget */ +template +ValueLight *createValueLight(Vec pos, Module *module, int lightId) { + ValueLight *light = new TLight(); + light->box.pos = pos; + light->value = &module->lights[lightId].value; + return light; +} + } // namespace rack diff --git a/src/engine.cpp b/src/engine.cpp index ef0163dd..5e2b9f05 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -34,7 +34,7 @@ static float smoothValue; void Light::setBrightnessSmooth(float brightness) { - value += (powf(brightness, 2) - value) / sampleRate * 60.0; + value += (brightness * brightness - value) / sampleRate * 60.0; }