You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 06326b0
Browse filesBrowse the repository at this point in the historyBrowse files
Add audioreactive color palettes (Ratio, Hue, Spectrum)
Port the getCRGBForBand palette generation logic from the upstream
WLED usermods/audioreactive fork, adding an opt-in 'add-palettes'
setting that registers three audio-reactive color palettes with the
core palette system and refreshes them each loop.
value = CRGB(fftResult[10]/2, fftResult[4]/2, fftResult[0]/2);
3367
+
} elseif(x == 255) {
3368
+
value = CRGB(fftResult[10]/2, fftResult[0]/2, fftResult[4]/2);
3369
+
} else {
3370
+
value = CRGB(fftResult[0]/2, fftResult[4]/2, fftResult[10]/2);
3371
+
}
3372
+
break;
3373
+
}
3374
+
return value;
3375
+
}
3376
+
3377
+
voidAudioReactive::fillAudioPalettes() {
3378
+
if (!palettes) return;
3379
+
// Scan by name pointer identity to find the palettes we added, palIndex = 0/1/2... selects the getCRGBForBand variant, matching how the entries were created.
3380
+
for (auto &ump : usermodPalettes) {
3381
+
if (ump.name != _name) continue;
3382
+
constint pal = ump.palIndex;
3383
+
uint8_t tcp[16]; // Needs to be 4 times however many colors are being used.
3384
+
// 3 colors = 12, 4 colors = 16, etc.
3385
+
3386
+
tcp[0] = 0; // anchor of first color - must be zero
3387
+
tcp[1] = 0;
3388
+
tcp[2] = 0;
3389
+
tcp[3] = 0;
3390
+
3391
+
CRGB rgb = getCRGBForBand(1, pal);
3392
+
tcp[4] = 1; // anchor of first color
3393
+
tcp[5] = rgb.r;
3394
+
tcp[6] = rgb.g;
3395
+
tcp[7] = rgb.b;
3396
+
3397
+
rgb = getCRGBForBand(128, pal);
3398
+
tcp[8] = 128;
3399
+
tcp[9] = rgb.r;
3400
+
tcp[10] = rgb.g;
3401
+
tcp[11] = rgb.b;
3402
+
3403
+
rgb = getCRGBForBand(255, pal);
3404
+
tcp[12] = 255; // anchor of last color - must be 255
3405
+
tcp[13] = rgb.r;
3406
+
tcp[14] = rgb.g;
3407
+
tcp[15] = rgb.b;
3408
+
3409
+
ump.palette.loadDynamicGradientPalette(tcp);
3410
+
}
3411
+
}
3412
+
3292
3413
// strings to reduce flash memory usage (used more than twice)
0 commit comments