Fixed getDouble returns int only
Added Rainbow Tail Factor
This commit is contained in:
parent
dd06aa3e35
commit
1a17f1db63
3 changed files with 4 additions and 2 deletions
|
@ -11,6 +11,7 @@ namespace VIZ {
|
|||
double lastValue = 0;
|
||||
double decayValue = 0;
|
||||
double ratios[4] = {1.3,1.2,1.3,1.4};
|
||||
double tailFactor = 0.3;
|
||||
public:
|
||||
RainbowLine(AudioGrabber *pGrabber, Vulcan121 *vulcan);
|
||||
~RainbowLine() override;
|
||||
|
|
|
@ -62,7 +62,7 @@ namespace VUtils {
|
|||
double Environment::getAsDouble(const std::string &name, double def) {
|
||||
char *end;
|
||||
auto *v = getEnv(name, "").c_str();
|
||||
double val = (int) std::strtod(v, &end);
|
||||
auto val = (double) std::strtod(v, &end);
|
||||
if (end == v) {
|
||||
setNumber(name.c_str(), def);
|
||||
return def;
|
||||
|
|
|
@ -21,13 +21,14 @@ namespace VIZ {
|
|||
void RainbowLine::on_setup() {
|
||||
currentColumn = 0;
|
||||
updateMap(0);
|
||||
tailFactor = VUtils::Math::clamp(grabber->env->getAsDouble("rainbow_tail_factor", 0.3), 0.0, 0.9);
|
||||
keyboard->send_led_to({ 0, 0, 0, 0 });
|
||||
grabber->requestMode = AudioGrabber::ReqMode::FFT;
|
||||
usleep(100000);
|
||||
}
|
||||
|
||||
void RainbowLine::on_tick(float delta) {
|
||||
updateMap(0.3);
|
||||
updateMap(tailFactor);
|
||||
deltaElapsed += delta;
|
||||
auto fftData = grabber->fft.getData()->leftChannel;
|
||||
auto val = 0.0;
|
||||
|
|
Loading…
Reference in a new issue