From a58ab537076ad56ff2596b90e395d8230cc9eed3 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Wed, 25 Oct 2017 22:13:59 -0400 Subject: [PATCH] Add Light::setBrightnessSmooth() --- include/engine.hpp | 3 ++- src/engine.cpp | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/engine.hpp b/include/engine.hpp index ce7d43d0..cfff9b1d 100644 --- a/include/engine.hpp +++ b/include/engine.hpp @@ -30,8 +30,9 @@ struct Output { }; struct Light { + /** The square of the brightness value */ float value = 0.0; - void setSmooth(float v); + void setBrightnessSmooth(float brightness); }; diff --git a/src/engine.cpp b/src/engine.cpp index f34ca99e..ef0163dd 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -33,8 +33,8 @@ static int smoothParamId; static float smoothValue; -void Light::setSmooth(float v) { - value += (v - value) / sampleRate * 60.0; +void Light::setBrightnessSmooth(float brightness) { + value += (powf(brightness, 2) - value) / sampleRate * 60.0; }