Add new Audio Responsive Ramp palette

This commit is contained in:
Will Tatam
2023-01-20 20:16:22 +00:00
parent f1fe6296e7
commit 89040a3a24
4 changed files with 12 additions and 4 deletions

View File

@@ -295,7 +295,8 @@ CRGBPalette16 &Segment::loadPalette(CRGBPalette16 &targetPalette, uint8_t pal) {
case 12: //Rainbow stripe colors
targetPalette = RainbowStripeColors_p; break;
case 71: //WLEDMM netmindz ar palette +1
case 72: //WLEDMM netmindz ar palette +1
case 72: //WLEDMM netmindz ar palette +2
case 73: //WLEDMM netmindz ar palette +3
targetPalette.loadDynamicGradientPalette(getAudioPalette(pal)); break;
default: //progmem palettes
if (pal>245) {
@@ -1959,5 +1960,5 @@ const char JSON_palette_names[] PROGMEM = R"=====([
"Magenta","Magred","Yelmag","Yelblu","Orange & Teal","Tiamat","April Night","Orangery","C9","Sakura",
"Aurora","Atlantica","C9 2","C9 New","Temperature","Aurora 2","Retro Clown","Candy","Toxy Reaf","Fairy Reaf",
"Semi Blue","Pink Candy","Red Reaf","Aqua Flash","Yelblu Hot","Lite Light","Red Flash","Blink Red","Red Shift","Red Tide",
"Candy2","Audio Responsive Ratio","Audio Responsive Hue"
"Candy2","Audio Responsive Ratio","Audio Responsive Hue","Audio Responsive Ramp"
])=====";

View File

@@ -5,7 +5,7 @@
* Readability defines and their associated numerical values + compile-time constants
*/
#define GRADIENT_PALETTE_COUNT 60 //WLEDMM netmindz ar palette +2
#define GRADIENT_PALETTE_COUNT 61 //WLEDMM netmindz ar palette +3
//Defaults
#define DEFAULT_CLIENT_SSID "Your_Network"

View File

@@ -918,6 +918,7 @@ const byte* const gGradientPalettes[] PROGMEM = {
// Palette contents not actually used as built on the fly, just here to create menu option
audio_responsive_gp, //71-58 AudioResponsive WLEDMM netmindz ar palette - placeholder1
audio_responsive_gp, //72-59 AudioResponsive WLEDMM netmindz ar palette - placeholder2
audio_responsive_gp, //73-60 AudioResponsive WLEDMM netmindz ar palette - placeholder3
};
#endif

View File

@@ -535,5 +535,11 @@ CRGB getCRGBForBand(int x, uint8_t *fftResult, int pal) {
hsv = CHSV(fftResult[b], 255, map(fftResult[b], 0, 255, 30, 255)); // pick hue
hsv2rgb_rainbow(hsv, value); // convert to R,G,B
}
else if(pal == 73) {
int b = map(x, 0, 255, 0, 8); // convert palette position to lower half of freq band
hsv = CHSV(uint8_t(fftResult[b]), 255, x);
hsv2rgb_rainbow(hsv, value); // convert to R,G,B
}
return value;
}
}