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 lastValue = 0;
|
||||||
double decayValue = 0;
|
double decayValue = 0;
|
||||||
double ratios[4] = {1.3,1.2,1.3,1.4};
|
double ratios[4] = {1.3,1.2,1.3,1.4};
|
||||||
|
double tailFactor = 0.3;
|
||||||
public:
|
public:
|
||||||
RainbowLine(AudioGrabber *pGrabber, Vulcan121 *vulcan);
|
RainbowLine(AudioGrabber *pGrabber, Vulcan121 *vulcan);
|
||||||
~RainbowLine() override;
|
~RainbowLine() override;
|
||||||
|
|
|
@ -62,7 +62,7 @@ namespace VUtils {
|
||||||
double Environment::getAsDouble(const std::string &name, double def) {
|
double Environment::getAsDouble(const std::string &name, double def) {
|
||||||
char *end;
|
char *end;
|
||||||
auto *v = getEnv(name, "").c_str();
|
auto *v = getEnv(name, "").c_str();
|
||||||
double val = (int) std::strtod(v, &end);
|
auto val = (double) std::strtod(v, &end);
|
||||||
if (end == v) {
|
if (end == v) {
|
||||||
setNumber(name.c_str(), def);
|
setNumber(name.c_str(), def);
|
||||||
return def;
|
return def;
|
||||||
|
|
|
@ -21,13 +21,14 @@ namespace VIZ {
|
||||||
void RainbowLine::on_setup() {
|
void RainbowLine::on_setup() {
|
||||||
currentColumn = 0;
|
currentColumn = 0;
|
||||||
updateMap(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 });
|
keyboard->send_led_to({ 0, 0, 0, 0 });
|
||||||
grabber->requestMode = AudioGrabber::ReqMode::FFT;
|
grabber->requestMode = AudioGrabber::ReqMode::FFT;
|
||||||
usleep(100000);
|
usleep(100000);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RainbowLine::on_tick(float delta) {
|
void RainbowLine::on_tick(float delta) {
|
||||||
updateMap(0.3);
|
updateMap(tailFactor);
|
||||||
deltaElapsed += delta;
|
deltaElapsed += delta;
|
||||||
auto fftData = grabber->fft.getData()->leftChannel;
|
auto fftData = grabber->fft.getData()->leftChannel;
|
||||||
auto val = 0.0;
|
auto val = 0.0;
|
||||||
|
|
Loading…
Reference in a new issue