| @@ -337,7 +337,6 @@ struct Rogan1PWhite : Rogan1P { | |||||
| struct SynthTechAlco : SVGKnob { | struct SynthTechAlco : SVGKnob { | ||||
| SynthTechAlco() { | SynthTechAlco() { | ||||
| box.size = Vec(45, 45); | |||||
| minAngle = -0.82*M_PI; | minAngle = -0.82*M_PI; | ||||
| maxAngle = 0.82*M_PI; | maxAngle = 0.82*M_PI; | ||||
| setSVG(SVG::load(assetGlobal("res/ComponentLibrary/SynthTechAlco.svg"))); | setSVG(SVG::load(assetGlobal("res/ComponentLibrary/SynthTechAlco.svg"))); | ||||
| @@ -32,6 +32,9 @@ struct Output { | |||||
| struct Light { | struct Light { | ||||
| /** The square of the brightness value */ | /** The square of the brightness value */ | ||||
| float value = 0.0; | float value = 0.0; | ||||
| void setBrightness(float brightness) { | |||||
| value = brightness * brightness; | |||||
| } | |||||
| void setBrightnessSmooth(float brightness); | void setBrightnessSmooth(float brightness); | ||||
| }; | }; | ||||
| @@ -2,12 +2,12 @@ | |||||
| #include "util.hpp" | #include "util.hpp" | ||||
| #include "math.hpp" | #include "math.hpp" | ||||
| #include "asset.hpp" | |||||
| #include "plugin.hpp" | #include "plugin.hpp" | ||||
| #include "engine.hpp" | #include "engine.hpp" | ||||
| #include "gui.hpp" | #include "gui.hpp" | ||||
| #include "app.hpp" | #include "app.hpp" | ||||
| #include "components.hpp" | #include "components.hpp" | ||||
| #include "asset.hpp" | |||||
| namespace rack { | namespace rack { | ||||
| @@ -80,5 +80,14 @@ ValueLight *createValueLight(Vec pos, float *value) { | |||||
| return light; | return light; | ||||
| } | } | ||||
| /** Polyfill for future LightWidget */ | |||||
| template <class TLight> | |||||
| 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 | } // namespace rack | ||||
| @@ -34,7 +34,7 @@ static float smoothValue; | |||||
| void Light::setBrightnessSmooth(float brightness) { | void Light::setBrightnessSmooth(float brightness) { | ||||
| value += (powf(brightness, 2) - value) / sampleRate * 60.0; | |||||
| value += (brightness * brightness - value) / sampleRate * 60.0; | |||||
| } | } | ||||