Bugfixes.
- moved simulateSound() to util - effect fixes (name changes) - mapping fixes - default values fixes - UI fixes
This commit is contained in:
parent
24fda89665
commit
78aad924c5
496
wled00/FX.cpp
496
wled00/FX.cpp
@ -3377,7 +3377,7 @@ uint16_t mode_exploding_fireworks(void)
|
||||
return FRAMETIME;
|
||||
}
|
||||
#undef MAX_SPARKS
|
||||
static const char *_data_FX_MODE_EXPLODING_FIREWORKS PROGMEM = "Fireworks 1D@Gravity,Firing side=128;!,!,;!=11";
|
||||
static const char *_data_FX_MODE_EXPLODING_FIREWORKS PROGMEM = "Fireworks 1D/2D@Gravity,Firing side=128;!,!,;!=11";
|
||||
|
||||
|
||||
/*
|
||||
@ -4674,7 +4674,7 @@ uint16_t mode_2Ddna(void) { // dna originally by by ldirko at https://pa
|
||||
if (!SEGENV.allocateData(dataSize)) return mode_static(); //allocation failed
|
||||
CRGB *leds = reinterpret_cast<CRGB*>(SEGENV.data);
|
||||
|
||||
if (SEGENV.call == 0) SEGMENT.fill_solid(leds, 0);
|
||||
if (SEGENV.call == 0) SEGMENT.fill_solid(leds, CRGB::Black);
|
||||
|
||||
SEGMENT.fadeToBlackBy(leds, 64);
|
||||
|
||||
@ -4687,7 +4687,7 @@ uint16_t mode_2Ddna(void) { // dna originally by by ldirko at https://pa
|
||||
SEGMENT.setPixels(leds);
|
||||
return FRAMETIME;
|
||||
} // mode_2Ddna()
|
||||
static const char *_data_FX_MODE_2DDNA PROGMEM = "2D DNA@Scroll speed,Blur;;!";
|
||||
static const char *_data_FX_MODE_2DDNA PROGMEM = "2D DNA@Scroll speed,Blur;1,2,3;!";
|
||||
|
||||
|
||||
/////////////////////////
|
||||
@ -5996,195 +5996,12 @@ static const char *_data_FX_MODE_2DDRIFTROSE PROGMEM = "2D Drift Rose@Fade,Blur;
|
||||
inputLevel = (uint8_t*) um_data->u_data[17]; // requires UI element (SEGMENT.customX?), changes source element
|
||||
} else {
|
||||
// add support for no audio data
|
||||
uint32_t ms = millis();
|
||||
sample = inoise8(beatsin8(120, 10, 30)*10 + (ms>>14), ms>>3);
|
||||
sample = map(sample, 50, 190, 0, 224);
|
||||
sampleAvg = inoise8(beatsin8(90, 0, 200)*15 + (ms>>10), ms>>3);
|
||||
samplePeak = random8() > 250; // or use: sample==224
|
||||
FFT_MajorPeak = inoise8(beatsin8(90, 0, 200)*15 + (ms>>10), ms>>3);
|
||||
um_data = simulateSound(SEGMENT.soundSim);
|
||||
}
|
||||
if (!myVals || !fftBin || ...) return mode_static();
|
||||
*/
|
||||
|
||||
|
||||
//Begin simulateSound
|
||||
|
||||
//Currently 3 types defined, to be finetuned and new types added
|
||||
typedef enum UM_SoundSimulations {
|
||||
UMS_Off = 0,
|
||||
UMS_BeatSin = 1,
|
||||
UMS_WeWillRockYou = 2,
|
||||
UMS_10_3 = 3,
|
||||
UMS_14_3 = 4
|
||||
} um_soundSimulations_t;
|
||||
|
||||
static um_data_t* um_data = nullptr;
|
||||
|
||||
//this is dirty coding, when sound effects are moved to audio_reactive.h, we can use the variables there
|
||||
|
||||
static float sampleAvg;
|
||||
static uint8_t soundAgc;
|
||||
static float sampleAgc;
|
||||
static int16_t sampleRaw;
|
||||
static int16_t rawSampleAgc;
|
||||
static uint8_t samplePeak;
|
||||
static float FFT_MajorPeak;
|
||||
static float FFT_Magnitude;
|
||||
|
||||
static uint8_t maxVol;
|
||||
static uint8_t binNum;
|
||||
static float multAgc;
|
||||
|
||||
float sampleGain;
|
||||
uint8_t soundSquelch;
|
||||
|
||||
uint8_t inputLevel;
|
||||
|
||||
um_data_t* simulateSound(uint8_t simulationId)
|
||||
{
|
||||
//arrays
|
||||
uint8_t *fftResult;
|
||||
uint8_t *myVals;
|
||||
float *fftBin;
|
||||
|
||||
if (!um_data) {
|
||||
//claim storage for arrays
|
||||
fftResult = (uint8_t *)malloc(sizeof(uint8_t) * 16);
|
||||
myVals = (uint8_t *)malloc(sizeof(uint8_t) * 32);
|
||||
fftBin = (float *)malloc(sizeof(float) * 256);
|
||||
|
||||
//initialize um_data pointer structure
|
||||
um_data = new um_data_t;
|
||||
um_data->u_size = 18;
|
||||
um_data->u_type = new um_types_t[um_data->u_size];
|
||||
um_data->u_data = new void*[um_data->u_size];
|
||||
um_data->u_data[0] = &sampleAvg;
|
||||
um_data->u_data[1] = &soundAgc;
|
||||
um_data->u_data[2] = &sampleAgc;
|
||||
um_data->u_data[3] = &sampleRaw;
|
||||
um_data->u_data[4] = &rawSampleAgc;
|
||||
um_data->u_data[5] = &samplePeak;
|
||||
um_data->u_data[6] = &FFT_MajorPeak;
|
||||
um_data->u_data[7] = &FFT_Magnitude;
|
||||
um_data->u_data[ 8] = fftResult;
|
||||
um_data->u_data[9] = &maxVol;
|
||||
um_data->u_data[10] = &binNum;
|
||||
um_data->u_data[11] = &multAgc;
|
||||
um_data->u_data[14] = myVals; //*used (only once, Pixels)
|
||||
um_data->u_data[13] = &sampleGain;
|
||||
um_data->u_data[15] = &soundSquelch;
|
||||
um_data->u_data[16] = fftBin; //only used in binmap
|
||||
um_data->u_data[17] = &inputLevel;
|
||||
}
|
||||
else {
|
||||
//get arrays from um_data
|
||||
fftResult = (uint8_t*)um_data->u_data[8];
|
||||
myVals = (uint8_t*)um_data->u_data[14];
|
||||
fftBin = (float*)um_data->u_data[16];
|
||||
}
|
||||
|
||||
uint32_t ms = millis();
|
||||
|
||||
switch (simulationId) {
|
||||
case UMS_Off:
|
||||
return um_data;
|
||||
case UMS_BeatSin:
|
||||
for (int i = 0; i<16; i++)
|
||||
fftResult[i] = beatsin8(120 / (i+1), 0, 255);
|
||||
// fftResult[i] = (beatsin8(120, 0, 255) + (256/16 * i)) % 256;
|
||||
sampleAvg = fftResult[8];
|
||||
break;
|
||||
case UMS_WeWillRockYou:
|
||||
if (ms%2000 < 200) {
|
||||
sampleAvg = random8(255);
|
||||
for (int i = 0; i<5; i++)
|
||||
fftResult[i] = random8(255);
|
||||
}
|
||||
else if (ms%2000 < 400) {
|
||||
sampleAvg = 0;
|
||||
for (int i = 0; i<16; i++)
|
||||
fftResult[i] = 0;
|
||||
}
|
||||
else if (ms%2000 < 600) {
|
||||
sampleAvg = random8(255);
|
||||
for (int i = 5; i<11; i++)
|
||||
fftResult[i] = random8(255);
|
||||
}
|
||||
else if (ms%2000 < 800) {
|
||||
sampleAvg = 0;
|
||||
for (int i = 0; i<16; i++)
|
||||
fftResult[i] = 0;
|
||||
}
|
||||
else if (ms%2000 < 1000) {
|
||||
sampleAvg = random8(255);
|
||||
for (int i = 11; i<16; i++)
|
||||
fftResult[i] = random8(255);
|
||||
}
|
||||
else {
|
||||
sampleAvg = 0;
|
||||
for (int i = 0; i<16; i++)
|
||||
fftResult[i] = 0;
|
||||
}
|
||||
break;
|
||||
case UMS_10_3:
|
||||
for (int i = 0; i<16; i++)
|
||||
fftResult[i] = inoise8(beatsin8(90 / (i+1), 0, 200)*15 + (ms>>10), ms>>3);
|
||||
sampleAvg = fftResult[8];
|
||||
break;
|
||||
case UMS_14_3:
|
||||
for (int i = 0; i<16; i++)
|
||||
fftResult[i] = inoise8(beatsin8(120 / (i+1), 10, 30)*10 + (ms>>14), ms>>3);
|
||||
sampleAvg = fftResult[8];
|
||||
break;
|
||||
}
|
||||
|
||||
//derive other vars from sampleAvg
|
||||
|
||||
//sampleAvg = mapf(sampleAvg, 0, 255, 0, 255); // help me out here
|
||||
soundAgc = 0; //only avg in simulations
|
||||
sampleAgc = sampleAvg;
|
||||
sampleRaw = sampleAvg;
|
||||
sampleRaw = map(sampleRaw, 50, 190, 0, 224);
|
||||
rawSampleAgc = sampleAvg;
|
||||
samplePeak = random8() > 250;
|
||||
FFT_MajorPeak = sampleAvg;
|
||||
FFT_Magnitude = sampleAvg;
|
||||
maxVol = 10;
|
||||
binNum = 8;
|
||||
multAgc = sampleAvg;
|
||||
myVals[millis()%32] = sampleAvg; // filling values semi randomly (why?)
|
||||
sampleGain = 40;
|
||||
soundSquelch = 10;
|
||||
for (int i = 0; i<256; i++) fftBin[i] = 256; // do we really need this???
|
||||
inputLevel = 128;
|
||||
|
||||
return um_data;
|
||||
}
|
||||
|
||||
void printUmData() //for testing
|
||||
{
|
||||
Serial.print(" 0: ");
|
||||
Serial.print(sampleAvg);
|
||||
Serial.print(" 1: ");
|
||||
Serial.print(soundAgc);
|
||||
Serial.print(" 2: ");
|
||||
Serial.print(sampleAgc);
|
||||
Serial.print(" 3: ");
|
||||
Serial.print(sampleRaw);
|
||||
Serial.print(" 4: ");
|
||||
Serial.print(rawSampleAgc);
|
||||
|
||||
Serial.print(" 5: ");
|
||||
Serial.print(samplePeak);
|
||||
Serial.print(" 6: ");
|
||||
Serial.print(FFT_MajorPeak);
|
||||
Serial.print(" 9: ");
|
||||
Serial.print(maxVol);
|
||||
Serial.print(" 10: ");
|
||||
Serial.print(binNum);
|
||||
Serial.println();
|
||||
}
|
||||
|
||||
/////////////////////////////////
|
||||
// * Ripple Peak //
|
||||
/////////////////////////////////
|
||||
@ -6257,7 +6074,7 @@ uint16_t mode_ripplepeak(void) { // * Ripple peak. By Andrew Tuli
|
||||
|
||||
return FRAMETIME;
|
||||
} // mode_ripplepeak()
|
||||
static const char *_data_FX_MODE_RIPPLEPEAK PROGMEM = " ♪ Ripple Peak@Fade rate,Max # of ripples,,Select bin,Volume (minimum)=0;!,!;!;mp12=0,ssim=1"; // Pixel, Beatsin
|
||||
static const char *_data_FX_MODE_RIPPLEPEAK PROGMEM = "Ripple Peak ♪@Fade rate,Max # of ripples,,Select bin,Volume (minimum)=0;!,!;!;mp12=0,ssim=1"; // Pixel, Beatsin
|
||||
|
||||
|
||||
#ifndef WLED_DISABLE_2D
|
||||
@ -6311,7 +6128,7 @@ uint16_t mode_2DSwirl(void) {
|
||||
SEGMENT.setPixels(leds);
|
||||
return FRAMETIME;
|
||||
} // mode_2DSwirl()
|
||||
static const char *_data_FX_MODE_2DSWIRL PROGMEM = " ♪ 2D Swirl@!,Sensitivity=64,Blur;,Bg Swirl;!;ssim=1"; // Beatsin
|
||||
static const char *_data_FX_MODE_2DSWIRL PROGMEM = "2D Swirl ♪@!,Sensitivity=64,Blur;,Bg Swirl;!;ssim=1"; // Beatsin
|
||||
|
||||
|
||||
/////////////////////////
|
||||
@ -6363,7 +6180,7 @@ uint16_t mode_2DWaverly(void) {
|
||||
SEGMENT.setPixels(leds);
|
||||
return FRAMETIME;
|
||||
} // mode_2DWaverly()
|
||||
static const char *_data_FX_MODE_2DWAVERLY PROGMEM = " ♪ 2D Waverly@Amplification,Sensitivity=64;;!;ssim=1"; // Beatsin
|
||||
static const char *_data_FX_MODE_2DWAVERLY PROGMEM = "2D Waverly ♪@Amplification,Sensitivity=64;;!;ssim=1"; // Beatsin
|
||||
|
||||
#endif // WLED_DISABLE_2D
|
||||
|
||||
@ -6392,9 +6209,9 @@ uint16_t mode_gravcenter(void) { // Gravcenter. By Andrew Tuline.
|
||||
// add support for no audio data
|
||||
um_data = simulateSound(SEGMENT.soundSim);
|
||||
}
|
||||
float sampleAvg = *(float*)um_data->u_data[0];
|
||||
float sampleAvg = *(float*) um_data->u_data[0];
|
||||
uint8_t soundAgc = *(uint8_t*)um_data->u_data[1];
|
||||
float sampleAgc = *(float*)um_data->u_data[2];
|
||||
float sampleAgc = *(float*) um_data->u_data[2];
|
||||
|
||||
float tmpSound = (soundAgc) ? sampleAgc : sampleAvg;
|
||||
|
||||
@ -6426,7 +6243,7 @@ uint16_t mode_gravcenter(void) { // Gravcenter. By Andrew Tuline.
|
||||
|
||||
return FRAMETIME;
|
||||
} // mode_gravcenter()
|
||||
static const char *_data_FX_MODE_GRAVCENTER PROGMEM = " ♪ Gravcenter@Rate of fall,Sensitivity=128;,!;!;mp12=2,ssim=1"; // Circle, Beatsin
|
||||
static const char *_data_FX_MODE_GRAVCENTER PROGMEM = "Gravcenter ♪@Rate of fall,Sensitivity=128;,!;!;mp12=2,ssim=1"; // Circle, Beatsin
|
||||
|
||||
|
||||
///////////////////////
|
||||
@ -6443,9 +6260,9 @@ uint16_t mode_gravcentric(void) { // Gravcentric. By Andrew
|
||||
// add support for no audio data
|
||||
um_data = simulateSound(SEGMENT.soundSim);
|
||||
}
|
||||
float sampleAvg = *(float*)um_data->u_data[0];
|
||||
float sampleAvg = *(float*) um_data->u_data[0];
|
||||
uint8_t soundAgc = *(uint8_t*)um_data->u_data[1];
|
||||
float sampleAgc = *(float*)um_data->u_data[2];
|
||||
float sampleAgc = *(float*) um_data->u_data[2];
|
||||
|
||||
// printUmData();
|
||||
|
||||
@ -6480,13 +6297,12 @@ uint16_t mode_gravcentric(void) { // Gravcentric. By Andrew
|
||||
|
||||
return FRAMETIME;
|
||||
} // mode_gravcentric()
|
||||
static const char *_data_FX_MODE_GRAVCENTRIC PROGMEM = " ♪ Gravcentric@Rate of fall,Sensitivity=128;!;!;mp12=2,ssim=1"; // Circle, Beatsin
|
||||
static const char *_data_FX_MODE_GRAVCENTRIC PROGMEM = "Gravcentric ♪@Rate of fall,Sensitivity=128;!;!;mp12=2,ssim=1"; // Circle, Beatsin
|
||||
|
||||
|
||||
///////////////////////
|
||||
// * GRAVIMETER //
|
||||
///////////////////////
|
||||
#ifndef SR_DEBUG_AGC
|
||||
uint16_t mode_gravimeter(void) { // Gravmeter. By Andrew Tuline.
|
||||
|
||||
uint16_t dataSize = sizeof(gravity);
|
||||
@ -6498,9 +6314,9 @@ uint16_t mode_gravimeter(void) { // Gravmeter. By Andrew Tuline.
|
||||
// add support for no audio data
|
||||
um_data = simulateSound(SEGMENT.soundSim);
|
||||
}
|
||||
float sampleAvg = *(float*)um_data->u_data[0];
|
||||
float sampleAvg = *(float*) um_data->u_data[0];
|
||||
uint8_t soundAgc = *(uint8_t*)um_data->u_data[1];
|
||||
float sampleAgc = *(float*)um_data->u_data[2];
|
||||
float sampleAgc = *(float*) um_data->u_data[2];
|
||||
|
||||
float tmpSound = (soundAgc) ? sampleAgc : sampleAvg;
|
||||
|
||||
@ -6530,74 +6346,7 @@ uint16_t mode_gravimeter(void) { // Gravmeter. By Andrew Tuline.
|
||||
|
||||
return FRAMETIME;
|
||||
} // mode_gravimeter()
|
||||
static const char *_data_FX_MODE_GRAVIMETER PROGMEM = " ♪ Gravimeter@Rate of fall,Sensitivity=128;,!;!;mp12=2,ssim=1"; // Circle, Beatsin
|
||||
#else
|
||||
// This an abuse of the gravimeter effect for AGC debugging
|
||||
// instead of sound volume, it uses the AGC gain multiplier as input
|
||||
uint16_t mode_gravimeter(void) { // Gravmeter. By Andrew Tuline.
|
||||
|
||||
uint16_t dataSize = sizeof(gravity);
|
||||
if (!SEGENV.allocateData(dataSize)) return mode_static(); //allocation failed
|
||||
Gravity* gravcen = reinterpret_cast<Gravity*>(SEGENV.data);
|
||||
|
||||
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
||||
um_data = simulateSound(SEGMENT.soundSim);
|
||||
}
|
||||
float sampleAvg = *(float*)um_data->u_data[0];
|
||||
uint8_t soundAgc = *(uint8_t*)um_data->u_data[1];
|
||||
// float sampleAgc = *(float*)um_data->u_data[2];
|
||||
uint16_t sampleRaw = *(uint16_t*)um_data->u_data[3];
|
||||
float multAgc = *(float*)um_data->u_data[11];
|
||||
float sampleReal = *(float*)um_data->u_data[12];
|
||||
float sampleGain = *(float*)um_data->u_data[13];
|
||||
uint8_t inputLevel = *(uint8_t*)um_data->u_data[17];
|
||||
|
||||
SEGMENT.fade_out(240);
|
||||
|
||||
//TODO: implement inputLevel as a global or slider
|
||||
inputLevel = SEGMENT.custom1;
|
||||
|
||||
float tmpSound = multAgc; // AGC gain
|
||||
if (soundAgc == 0) {
|
||||
if ((sampleAvg> 1.0f) && (sampleReal > 0.05f))
|
||||
tmpSound = (float)sampleRaw / sampleReal; // current non-AGC gain
|
||||
else
|
||||
tmpSound = ((float)sampleGain/40.0f * (float)inputLevel/128.0f) + 1.0f/16.0f; // non-AGC gain from presets
|
||||
}
|
||||
|
||||
if (tmpSound > 2) tmpSound = ((tmpSound -2.0f) / 2) +2; //compress ranges > 2
|
||||
if (tmpSound > 1) tmpSound = ((tmpSound -1.0f) / 2) +1; //compress ranges > 1
|
||||
|
||||
float segmentSampleAvg = 64.0f * tmpSound * (float)SEGMENT.intensity / 128.0f;
|
||||
float mySampleAvg = mapf(segmentSampleAvg, 0.0f, 128.0f, 0, (SEGLEN-1)); // map to pixels availeable in current segment
|
||||
int tempsamp = constrain(mySampleAvg, 0, SEGLEN-1); // Keep the sample from overflowing.
|
||||
|
||||
//tempsamp = SEGLEN - tempsamp; // uncomment to invert direction
|
||||
segmentSampleAvg = fmax(64.0f - fmin(segmentSampleAvg, 63),8); // inverted brightness
|
||||
|
||||
uint8_t gravity = 8 - SEGMENT.speed/32;
|
||||
|
||||
if (sampleAvg > 1) // disable bar "body" if below squelch
|
||||
{
|
||||
for (int i=0; i<tempsamp; i++) {
|
||||
uint8_t index = inoise8(i*segmentSampleAvg+millis(), 5000+i*segmentSampleAvg);
|
||||
SEGMENT.setPixelColor(i, color_blend(SEGCOLOR(1), SEGMENT.color_from_palette(index, false, PALETTE_SOLID_WRAP, 0), segmentSampleAvg*4.0));
|
||||
}
|
||||
}
|
||||
if (tempsamp >= gravcen->topLED)
|
||||
gravcen->topLED = tempsamp;
|
||||
else if (gravcen->gravityCounter % gravity == 0)
|
||||
gravcen->topLED--;
|
||||
|
||||
if (gravcen->topLED > 0) {
|
||||
SEGMENT.setPixelColor(gravcen->topLED, SEGMENT.color_from_palette(millis(), false, PALETTE_SOLID_WRAP, 0));
|
||||
}
|
||||
gravcen->gravityCounter = (gravcen->gravityCounter + 1) % gravity;
|
||||
|
||||
return FRAMETIME;
|
||||
} // mode_gravimeter()
|
||||
static const char *_data_FX_MODE_GRAVIMETER PROGMEM = " ♪ Gravimeter@Rate of fall,Sensitivity=128,Input level=128;,!;!;mp12=2,ssim=1"; // Circle, Beatsin
|
||||
#endif
|
||||
static const char *_data_FX_MODE_GRAVIMETER PROGMEM = "Gravimeter ♪@Rate of fall,Sensitivity=128;,!;!;mp12=2,ssim=1"; // Circle, Beatsin
|
||||
|
||||
|
||||
//////////////////////
|
||||
@ -6620,7 +6369,7 @@ uint16_t mode_juggles(void) { // Juggles. By Andrew Tuline.
|
||||
|
||||
return FRAMETIME;
|
||||
} // mode_juggles()
|
||||
static const char *_data_FX_MODE_JUGGLES PROGMEM = " ♪ Juggles@!,# of balls;,!;!;mp12=0,ssim=1"; // Pixels, Beatsin
|
||||
static const char *_data_FX_MODE_JUGGLES PROGMEM = "Juggles ♪@!,# of balls;,!;!;mp12=0,ssim=1"; // Pixels, Beatsin
|
||||
|
||||
|
||||
//////////////////////
|
||||
@ -6650,7 +6399,7 @@ uint16_t mode_matripix(void) { // Matripix. By Andrew Tuline.
|
||||
|
||||
return FRAMETIME;
|
||||
} // mode_matripix()
|
||||
static const char *_data_FX_MODE_MATRIPIX PROGMEM = " ♪ Matripix@!,Brightness=64;!,!;!;mp12=2,ssim=2,rev=1,mi=1,rY=1,mY=1"; // Circle, WeWillRockYou, reverseX
|
||||
static const char *_data_FX_MODE_MATRIPIX PROGMEM = "Matripix ♪@!,Brightness=64;!,!;!;mp12=2,ssim=2,rev=1,mi=1,rY=1,mY=1"; // Circle, WeWillRockYou, reverseX
|
||||
|
||||
|
||||
//////////////////////
|
||||
@ -6664,9 +6413,9 @@ uint16_t mode_midnoise(void) { // Midnoise. By Andrew Tuline.
|
||||
// add support for no audio data
|
||||
um_data = simulateSound(SEGMENT.soundSim);
|
||||
}
|
||||
float sampleAvg = *(float*)um_data->u_data[0];
|
||||
float sampleAvg = *(float*) um_data->u_data[0];
|
||||
uint8_t soundAgc = *(uint8_t*)um_data->u_data[1];
|
||||
float sampleAgc = *(float*)um_data->u_data[2];
|
||||
float sampleAgc = *(float*) um_data->u_data[2];
|
||||
|
||||
SEGMENT.fade_out(SEGMENT.speed);
|
||||
SEGMENT.fade_out(SEGMENT.speed);
|
||||
@ -6688,7 +6437,7 @@ uint16_t mode_midnoise(void) { // Midnoise. By Andrew Tuline.
|
||||
|
||||
return FRAMETIME;
|
||||
} // mode_midnoise()
|
||||
static const char *_data_FX_MODE_MIDNOISE PROGMEM = " ♪ Midnoise@Fade rate,Maximum length=128;,!;!;mp12=2,ssim=1"; // Circle, Beatsin
|
||||
static const char *_data_FX_MODE_MIDNOISE PROGMEM = "Midnoise ♪@Fade rate,Maximum length=128;,!;!;mp12=2,ssim=1"; // Circle, Beatsin
|
||||
|
||||
|
||||
//////////////////////
|
||||
@ -6706,9 +6455,9 @@ uint16_t mode_noisefire(void) { // Noisefire. By Andrew Tuline.
|
||||
// add support for no audio data
|
||||
um_data = simulateSound(SEGMENT.soundSim);
|
||||
}
|
||||
float sampleAvg = *(float*)um_data->u_data[0];
|
||||
float sampleAvg = *(float*) um_data->u_data[0];
|
||||
uint8_t soundAgc = *(uint8_t*)um_data->u_data[1];
|
||||
float sampleAgc = *(float*)um_data->u_data[2];
|
||||
float sampleAgc = *(float*) um_data->u_data[2];
|
||||
|
||||
for (uint16_t i = 0; i < SEGLEN; i++) {
|
||||
uint16_t index = inoise8(i*SEGMENT.speed/64,millis()*SEGMENT.speed/64*SEGLEN/255); // X location is constant, but we move along the Y at the rate of millis(). By Andrew Tuline.
|
||||
@ -6722,7 +6471,7 @@ uint16_t mode_noisefire(void) { // Noisefire. By Andrew Tuline.
|
||||
|
||||
return FRAMETIME;
|
||||
} // mode_noisefire()
|
||||
static const char *_data_FX_MODE_NOISEFIRE PROGMEM = " ♪ Noisefire@!,!;;;mp12=2,ssim=1"; // Circle, Beatsin
|
||||
static const char *_data_FX_MODE_NOISEFIRE PROGMEM = "Noisefire ♪@!,!;;;mp12=2,ssim=1"; // Circle, Beatsin
|
||||
|
||||
|
||||
///////////////////////
|
||||
@ -6735,9 +6484,9 @@ uint16_t mode_noisemeter(void) { // Noisemeter. By Andrew Tuline.
|
||||
// add support for no audio data
|
||||
um_data = simulateSound(SEGMENT.soundSim);
|
||||
}
|
||||
float sampleAvg = *(float*)um_data->u_data[0];
|
||||
float sampleAvg = *(float*) um_data->u_data[0];
|
||||
uint8_t soundAgc = *(uint8_t*)um_data->u_data[1];
|
||||
float sampleAgc = *(float*)um_data->u_data[2];
|
||||
float sampleAgc = *(float*) um_data->u_data[2];
|
||||
int16_t sampleRaw = *(int16_t*)um_data->u_data[3];
|
||||
int16_t rawSampleAgc = *(int16_t*)um_data->u_data[4];
|
||||
|
||||
@ -6760,7 +6509,7 @@ uint16_t mode_noisemeter(void) { // Noisemeter. By Andrew Tuline.
|
||||
|
||||
return FRAMETIME;
|
||||
} // mode_noisemeter()
|
||||
static const char *_data_FX_MODE_NOISEMETER PROGMEM = " ♪ Noisemeter@Fade rate,Width=128;!,!;!;mp12=2,ssim=1"; // Circle, Beatsin
|
||||
static const char *_data_FX_MODE_NOISEMETER PROGMEM = "Noisemeter ♪@Fade rate,Width=128;!,!;!;mp12=2,ssim=1"; // Circle, Beatsin
|
||||
|
||||
|
||||
//////////////////////
|
||||
@ -6793,7 +6542,7 @@ uint16_t mode_pixelwave(void) { // Pixelwave. By Andrew Tuline.
|
||||
|
||||
return FRAMETIME;
|
||||
} // mode_pixelwave()
|
||||
static const char *_data_FX_MODE_PIXELWAVE PROGMEM = " ♪ Pixelwave@!,Sensitivity=64;!,!;!;mp12=2,ssim=1"; // Circle, Beatsin
|
||||
static const char *_data_FX_MODE_PIXELWAVE PROGMEM = "Pixelwave ♪@!,Sensitivity=64;!,!;!;mp12=2,ssim=1"; // Circle, Beatsin
|
||||
|
||||
|
||||
//////////////////////
|
||||
@ -6814,9 +6563,9 @@ uint16_t mode_plasmoid(void) { // Plasmoid. By Andrew Tuline.
|
||||
// add support for no audio data
|
||||
um_data = simulateSound(SEGMENT.soundSim);
|
||||
}
|
||||
float sampleAvg = *(float*)um_data->u_data[0];
|
||||
float sampleAvg = *(float*) um_data->u_data[0];
|
||||
uint8_t soundAgc = *(uint8_t*)um_data->u_data[1];
|
||||
float sampleAgc = *(float*)um_data->u_data[2];
|
||||
float sampleAgc = *(float*) um_data->u_data[2];
|
||||
|
||||
SEGMENT.fade_out(64);
|
||||
|
||||
@ -6837,7 +6586,7 @@ uint16_t mode_plasmoid(void) { // Plasmoid. By Andrew Tuline.
|
||||
|
||||
return FRAMETIME;
|
||||
} // mode_plasmoid()
|
||||
static const char *_data_FX_MODE_PLASMOID PROGMEM = " ♪ Plasmoid@Phase=128,# of pixels=128;,!;!;mp12=0,ssim=1"; // Pixels, Beatsin
|
||||
static const char *_data_FX_MODE_PLASMOID PROGMEM = "Plasmoid ♪@Phase=128,# of pixels=128;,!;!;mp12=0,ssim=1"; // Pixels, Beatsin
|
||||
|
||||
|
||||
///////////////////////
|
||||
@ -6855,18 +6604,18 @@ uint16_t mode_puddlepeak(void) { // Puddlepeak. By Andrew Tuline.
|
||||
// add support for no audio data
|
||||
um_data = simulateSound(SEGMENT.soundSim);
|
||||
}
|
||||
float sampleAgc = *(float*)um_data->u_data[2];
|
||||
float sampleAgc = *(float*) um_data->u_data[2];
|
||||
uint8_t samplePeak = *(uint8_t*)um_data->u_data[5];
|
||||
uint8_t maxVol = *(uint8_t*)um_data->u_data[9];
|
||||
uint8_t binNum = *(uint8_t*)um_data->u_data[10];
|
||||
uint8_t *maxVol = (uint8_t*)um_data->u_data[9];
|
||||
uint8_t *binNum = (uint8_t*)um_data->u_data[10];
|
||||
|
||||
if (SEGENV.call == 0) {
|
||||
SEGMENT.custom2 = binNum;
|
||||
SEGMENT.custom3 = maxVol * 2;
|
||||
SEGMENT.custom2 = *binNum;
|
||||
SEGMENT.custom3 = *maxVol * 2;
|
||||
}
|
||||
|
||||
binNum = SEGMENT.custom2; // Select a bin.
|
||||
maxVol = SEGMENT.custom3/4; // Our volume comparator.
|
||||
*binNum = SEGMENT.custom2; // Select a bin.
|
||||
*maxVol = SEGMENT.custom3/4; // Our volume comparator.
|
||||
|
||||
SEGMENT.fade_out(fadeVal);
|
||||
|
||||
@ -6881,7 +6630,7 @@ uint16_t mode_puddlepeak(void) { // Puddlepeak. By Andrew Tuline.
|
||||
|
||||
return FRAMETIME;
|
||||
} // mode_puddlepeak()
|
||||
static const char *_data_FX_MODE_PUDDLEPEAK PROGMEM = " ♪ Puddlepeak@Fade rate,Puddle size,,Select bin,Volume (minimum)=0;!,!;!;mp12=0,ssim=1"; // Pixels, Beatsin
|
||||
static const char *_data_FX_MODE_PUDDLEPEAK PROGMEM = "Puddlepeak ♪@Fade rate,Puddle size,,Select bin,Volume (minimum)=0;!,!;!;mp12=0,ssim=1"; // Pixels, Beatsin
|
||||
|
||||
|
||||
//////////////////////
|
||||
@ -6916,7 +6665,7 @@ uint16_t mode_puddles(void) { // Puddles. By Andrew Tuline.
|
||||
|
||||
return FRAMETIME;
|
||||
} // mode_puddles()
|
||||
static const char *_data_FX_MODE_PUDDLES PROGMEM = " ♪ Puddles@Fade rate,Puddle size;!,!;!;mp12=0,ssim=1"; // Pixels, Beatsin
|
||||
static const char *_data_FX_MODE_PUDDLES PROGMEM = "Puddles ♪@Fade rate,Puddle size;!,!;!;mp12=0,ssim=1"; // Pixels, Beatsin
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -6933,7 +6682,7 @@ uint16_t mode_pixels(void) { // Pixels. By Andrew Tuline.
|
||||
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
||||
um_data = simulateSound(SEGMENT.soundSim);
|
||||
}
|
||||
float sampleAgc = *(float*)um_data->u_data[2];
|
||||
float sampleAgc = *(float*) um_data->u_data[2];
|
||||
uint16_t *myVals = (uint16_t*)um_data->u_data[14];
|
||||
if (!myVals) return mode_static();
|
||||
|
||||
@ -6946,92 +6695,13 @@ uint16_t mode_pixels(void) { // Pixels. By Andrew Tuline.
|
||||
|
||||
return FRAMETIME;
|
||||
} // mode_pixels()
|
||||
static const char *_data_FX_MODE_PIXELS PROGMEM = " ♪ Pixels@Fade rate,# of pixels;,!;!;mp12=0,ssim=1"; // Pixels, Beatsin
|
||||
static const char *_data_FX_MODE_PIXELS PROGMEM = "Pixels ♪@Fade rate,# of pixels;,!;!;mp12=0,ssim=1"; // Pixels, Beatsin
|
||||
|
||||
|
||||
///////////////////////////////
|
||||
// BEGIN FFT ROUTINES //
|
||||
///////////////////////////////
|
||||
|
||||
////////////////////
|
||||
// ** Binmap //
|
||||
////////////////////
|
||||
// Binmap. Scale raw fftBin[] values to SEGLEN. Shows just how noisy those bins are.
|
||||
uint16_t mode_binmap(void) {
|
||||
#define FIRSTBIN 3 // The first 3 bins are garbage.
|
||||
#define LASTBIN 255 // Don't use the highest bins, as they're (almost) a mirror of the first 256.
|
||||
|
||||
float maxVal = 512; // Kind of a guess as to the maximum output value per combined logarithmic bins.
|
||||
|
||||
um_data_t *um_data;
|
||||
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
||||
um_data = simulateSound(SEGMENT.soundSim);
|
||||
}
|
||||
#ifdef SR_DEBUG
|
||||
uint8_t *maxVol = (uint8_t*)um_data->u_data[9];
|
||||
#endif
|
||||
float sampleAvg = *(float*) um_data->u_data[0];
|
||||
uint8_t soundAgc = *(uint8_t*)um_data->u_data[1];
|
||||
float multAgc = *(float*) um_data->u_data[11];
|
||||
float sampleGain = *(float*) um_data->u_data[13];
|
||||
uint8_t soundSquelch = *(uint8_t*)um_data->u_data[15];
|
||||
float *fftBin = (float*) um_data->u_data[16];
|
||||
uint8_t inputLevel = *(uint8_t*)um_data->u_data[17];
|
||||
if (!fftBin) return mode_static();
|
||||
|
||||
if (SEGENV.call == 0) {
|
||||
SEGMENT.custom1 = inputLevel;
|
||||
#ifdef SR_DEBUG
|
||||
SEGMENT.custom3 = *maxVol;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
//TODO: implement inputLevel as a global or slider
|
||||
inputLevel = SEGMENT.custom1;
|
||||
float binScale = (((float)sampleGain / 40.0f) + 1.0f/16.f) * ((float)inputLevel/128.0f); // non-AGC gain multiplier
|
||||
if (soundAgc) binScale = multAgc; // AGC gain
|
||||
if (sampleAvg < 1) binScale = 0.001f; // silentium!
|
||||
|
||||
#ifdef SR_DEBUG
|
||||
//The next lines are good for debugging, however too much flickering for non-developers ;-)
|
||||
float my_magnitude = FFT_Magnitude / 16.0f; // scale magnitude to be aligned with scaling of FFT bins
|
||||
my_magnitude *= binScale; // apply gain
|
||||
*maxVol = fmax(64, my_magnitude); // set maxVal = max FFT result
|
||||
#endif
|
||||
|
||||
for (int i=0; i<SEGLEN; i++) {
|
||||
|
||||
uint16_t startBin = FIRSTBIN+i*(LASTBIN-FIRSTBIN)/SEGLEN; // This is the START bin for this particular pixel.
|
||||
uint16_t endBin = FIRSTBIN+(i+1)*(LASTBIN-FIRSTBIN)/SEGLEN; // This is the END bin for this particular pixel.
|
||||
if (endBin > startBin) endBin --; // avoid overlapping
|
||||
|
||||
float sumBin = 0;
|
||||
|
||||
for (int j=startBin; j<=endBin; j++) {
|
||||
sumBin += (fftBin[j] < soundSquelch*1.75f) ? 0 : fftBin[j]; // We need some sound temporary squelch for fftBin, because we didn't do it for the raw bins in audio_reactive.h
|
||||
}
|
||||
|
||||
sumBin = sumBin/(endBin-startBin+1); // Normalize it.
|
||||
sumBin = sumBin * (i+5) / (endBin-startBin+5); // Disgusting frequency adjustment calculation. Lows were too bright. Am open to quick 'n dirty alternatives.
|
||||
|
||||
sumBin = sumBin * 8; // Need to use the 'log' version for this. Why " * 8" ??
|
||||
sumBin *= binScale; // apply gain
|
||||
|
||||
if (sumBin > maxVal) sumBin = maxVal; // Make sure our bin isn't higher than the max . . which we capped earlier.
|
||||
|
||||
uint8_t bright = constrain(mapf(sumBin, 0, maxVal, 0, 255),0,255); // Map the brightness in relation to maxVal and crunch to 8 bits.
|
||||
|
||||
SEGMENT.setPixelColor(i, color_blend(SEGCOLOR(1), SEGMENT.color_from_palette(i*8+millis()/50, false, PALETTE_SOLID_WRAP, 0), bright)); // 'i' is just an index in the palette. The FFT value, bright, is the intensity.
|
||||
} // for i
|
||||
|
||||
return FRAMETIME;
|
||||
} // mode_binmap()
|
||||
#ifdef SR_DEBUG
|
||||
static const char *_data_FX_MODE_BINMAP PROGMEM = " ♫ Binmap@,,Input level=128,,Max vol;!,!;!;mp12=0,ssim=1,rY=1"; // Pixels, Beatsin, ReverseY
|
||||
#else
|
||||
static const char *_data_FX_MODE_BINMAP PROGMEM = " ♫ Binmap@,,Input level=128;!,!;!;mp12=0,ssim=1,rY=1"; // Pixels, Beatsin, ReverseY
|
||||
#endif
|
||||
|
||||
//////////////////////
|
||||
// ** Blurz //
|
||||
@ -7060,7 +6730,7 @@ uint16_t mode_blurz(void) { // Blurz. By Andrew Tuline.
|
||||
|
||||
return FRAMETIME;
|
||||
} // mode_blurz()
|
||||
static const char *_data_FX_MODE_BLURZ PROGMEM = " ♫ Blurz@Fade rate,Blur amount;!,Color mix;!;mp12=0,ssim=1"; // Pixels, Beatsin
|
||||
static const char *_data_FX_MODE_BLURZ PROGMEM = "Blurz ♫@Fade rate,Blur amount;!,Color mix;!;mp12=0,ssim=1"; // Pixels, Beatsin
|
||||
|
||||
|
||||
/////////////////////////
|
||||
@ -7097,7 +6767,7 @@ uint16_t mode_DJLight(void) { // Written by ??? Adapted by Wil
|
||||
|
||||
return FRAMETIME;
|
||||
} // mode_DJLight()
|
||||
static const char *_data_FX_MODE_DJLIGHT PROGMEM = " ♫ DJ Light@Speed;;;mp12=2,ssim=1"; // Circle, Beatsin
|
||||
static const char *_data_FX_MODE_DJLIGHT PROGMEM = "DJ Light ♫@Speed;;;mp12=2,ssim=1"; // Circle, Beatsin
|
||||
|
||||
|
||||
////////////////////
|
||||
@ -7112,11 +6782,11 @@ uint16_t mode_freqmap(void) { // Map FFT_MajorPeak to SEGLEN.
|
||||
// add support for no audio data
|
||||
um_data = simulateSound(SEGMENT.soundSim);
|
||||
}
|
||||
float sampleAvg = *(float*)um_data->u_data[0];
|
||||
float sampleAvg = *(float*) um_data->u_data[0];
|
||||
uint8_t soundAgc = *(uint8_t*)um_data->u_data[1];
|
||||
float FFT_MajorPeak = *(float*)um_data->u_data[6];
|
||||
float FFT_Magnitude = *(float*)um_data->u_data[7];
|
||||
float multAgc = *(float*)um_data->u_data[11];
|
||||
float FFT_MajorPeak = *(float*) um_data->u_data[6];
|
||||
float FFT_Magnitude = *(float*) um_data->u_data[7];
|
||||
float multAgc = *(float*) um_data->u_data[11];
|
||||
|
||||
float my_magnitude = FFT_Magnitude / 4.0;
|
||||
if (soundAgc) my_magnitude *= multAgc;
|
||||
@ -7134,7 +6804,7 @@ uint16_t mode_freqmap(void) { // Map FFT_MajorPeak to SEGLEN.
|
||||
|
||||
return FRAMETIME;
|
||||
} // mode_freqmap()
|
||||
static const char *_data_FX_MODE_FREQMAP PROGMEM = " ♫ Freqmap@Fade rate,Starting color;,!;!;mp12=2,ssim=1"; // Circle, Beatsin
|
||||
static const char *_data_FX_MODE_FREQMAP PROGMEM = "Freqmap ♫@Fade rate,Starting color;,!;!;mp12=2,ssim=1"; // Circle, Beatsin
|
||||
|
||||
|
||||
///////////////////////
|
||||
@ -7184,7 +6854,7 @@ uint16_t mode_freqmatrix(void) { // Freqmatrix. By Andreas Plesch
|
||||
|
||||
return FRAMETIME;
|
||||
} // mode_freqmatrix()
|
||||
static const char *_data_FX_MODE_FREQMATRIX PROGMEM = " ♫ Freqmatrix@Time delay,Sound effect,Low bin,High bin,Sensivity;;;mp12=0,ssim=1"; // Pixels, Beatsin
|
||||
static const char *_data_FX_MODE_FREQMATRIX PROGMEM = "Freqmatrix ♫@Time delay,Sound effect,Low bin,High bin,Sensivity;;;mp12=0,ssim=1"; // Pixels, Beatsin
|
||||
|
||||
|
||||
//////////////////////
|
||||
@ -7195,15 +6865,16 @@ static const char *_data_FX_MODE_FREQMATRIX PROGMEM = " ♫ Freqmatrix@Time dela
|
||||
// SEGMENT.speed select faderate
|
||||
// SEGMENT.intensity select colour index
|
||||
uint16_t mode_freqpixels(void) { // Freqpixel. By Andrew Tuline.
|
||||
um_data_t *um_data;
|
||||
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
||||
// add support for no audio data
|
||||
um_data = simulateSound(SEGMENT.soundSim);
|
||||
}
|
||||
float sampleAvg = *(float*)um_data->u_data[0];
|
||||
float sampleAvg = *(float*) um_data->u_data[0];
|
||||
uint8_t soundAgc = *(uint8_t*)um_data->u_data[1];
|
||||
float FFT_MajorPeak = *(float*)um_data->u_data[6];
|
||||
float FFT_Magnitude = *(float*)um_data->u_data[7];
|
||||
float multAgc = *(float*)um_data->u_data[11];
|
||||
float FFT_MajorPeak = *(float*) um_data->u_data[6];
|
||||
float FFT_Magnitude = *(float*) um_data->u_data[7];
|
||||
float multAgc = *(float*) um_data->u_data[11];
|
||||
|
||||
float my_magnitude = FFT_Magnitude / 16.0;
|
||||
if (soundAgc) my_magnitude *= multAgc;
|
||||
@ -7220,7 +6891,7 @@ uint16_t mode_freqpixels(void) { // Freqpixel. By Andrew Tuline.
|
||||
|
||||
return FRAMETIME;
|
||||
} // mode_freqpixels()
|
||||
static const char *_data_FX_MODE_FREQPIXELS PROGMEM = " ♫ Freqpixels@Fade rate,Starting colour and # of pixels;;;mp12=0,ssim=1"; // Pixels, Beatsin
|
||||
static const char *_data_FX_MODE_FREQPIXELS PROGMEM = "Freqpixels ♫@Fade rate,Starting colour and # of pixels;;;mp12=0,ssim=1"; // Pixels, Beatsin
|
||||
|
||||
|
||||
//////////////////////
|
||||
@ -7244,10 +6915,10 @@ uint16_t mode_freqwave(void) { // Freqwave. By Andreas Pleschun
|
||||
// add support for no audio data
|
||||
um_data = simulateSound(SEGMENT.soundSim);
|
||||
}
|
||||
float sampleAvg = *(float*)um_data->u_data[0];
|
||||
float sampleAvg = *(float*) um_data->u_data[0];
|
||||
uint8_t soundAgc = *(uint8_t*)um_data->u_data[1];
|
||||
float sampleAgc = *(float*)um_data->u_data[2];
|
||||
float FFT_MajorPeak = *(float*)um_data->u_data[6];
|
||||
float sampleAgc = *(float*) um_data->u_data[2];
|
||||
float FFT_MajorPeak = *(float*) um_data->u_data[6];
|
||||
|
||||
uint8_t secondHand = micros()/(256-SEGMENT.speed)/500 % 16;
|
||||
if(SEGENV.aux0 != secondHand) {
|
||||
@ -7291,7 +6962,7 @@ uint16_t mode_freqwave(void) { // Freqwave. By Andreas Pleschun
|
||||
|
||||
return FRAMETIME;
|
||||
} // mode_freqwave()
|
||||
static const char *_data_FX_MODE_FREQWAVE PROGMEM = " ♫ Freqwave@Time delay,Sound effect,Low bin,High bin,Pre-amp;;;mp12=2,ssim=1"; // Circle, Beatsin
|
||||
static const char *_data_FX_MODE_FREQWAVE PROGMEM = "Freqwave ♫@Time delay,Sound effect,Low bin,High bin,Pre-amp;;;mp12=2,ssim=1"; // Circle, Beatsin
|
||||
|
||||
|
||||
///////////////////////
|
||||
@ -7308,10 +6979,10 @@ uint16_t mode_gravfreq(void) { // Gravfreq. By Andrew Tuline.
|
||||
// add support for no audio data
|
||||
um_data = simulateSound(SEGMENT.soundSim);
|
||||
}
|
||||
float sampleAvg = *(float*)um_data->u_data[0];
|
||||
float sampleAvg = *(float*) um_data->u_data[0];
|
||||
uint8_t soundAgc = *(uint8_t*)um_data->u_data[1];
|
||||
float sampleAgc = *(float*)um_data->u_data[2];
|
||||
float FFT_MajorPeak = *(float*)um_data->u_data[6];
|
||||
float sampleAgc = *(float*) um_data->u_data[2];
|
||||
float FFT_MajorPeak = *(float*) um_data->u_data[6];
|
||||
|
||||
SEGMENT.fade_out(240);
|
||||
|
||||
@ -7344,7 +7015,7 @@ uint16_t mode_gravfreq(void) { // Gravfreq. By Andrew Tuline.
|
||||
|
||||
return FRAMETIME;
|
||||
} // mode_gravfreq()
|
||||
static const char *_data_FX_MODE_GRAVFREQ PROGMEM = " ♫ Gravfreq@Rate of fall,Sensivity=128;,!;!;mp12=2,ssim=1"; // Circle, Beatsin
|
||||
static const char *_data_FX_MODE_GRAVFREQ PROGMEM = "Gravfreq ♫@Rate of fall,Sensivity=128;,!;!;mp12=2,ssim=1"; // Circle, Beatsin
|
||||
|
||||
|
||||
//////////////////////
|
||||
@ -7370,7 +7041,7 @@ uint16_t mode_noisemove(void) { // Noisemove. By: Andrew Tuli
|
||||
|
||||
return FRAMETIME;
|
||||
} // mode_noisemove()
|
||||
static const char *_data_FX_MODE_NOISEMOVE PROGMEM = " ♫ Noisemove@Speed of perlin movement,Fade rate;,!;!;mp12=0,ssim=1"; // Pixels, Beatsin
|
||||
static const char *_data_FX_MODE_NOISEMOVE PROGMEM = "Noisemove ♫@Speed of perlin movement,Fade rate;,!;!;mp12=0,ssim=1"; // Pixels, Beatsin
|
||||
|
||||
|
||||
//////////////////////
|
||||
@ -7382,11 +7053,11 @@ uint16_t mode_rocktaves(void) { // Rocktaves. Same note from eac
|
||||
// add support for no audio data
|
||||
um_data = simulateSound(SEGMENT.soundSim);
|
||||
}
|
||||
float sampleAvg = *(float*)um_data->u_data[0];
|
||||
float sampleAvg = *(float*) um_data->u_data[0];
|
||||
uint8_t soundAgc = *(uint8_t*)um_data->u_data[1];
|
||||
float FFT_MajorPeak = *(float*)um_data->u_data[6];
|
||||
float FFT_Magnitude = *(float*)um_data->u_data[7];
|
||||
float multAgc = *(float*)um_data->u_data[11];
|
||||
float FFT_MajorPeak = *(float*) um_data->u_data[6];
|
||||
float FFT_Magnitude = *(float*) um_data->u_data[7];
|
||||
float multAgc = *(float*) um_data->u_data[11];
|
||||
|
||||
SEGMENT.fade_out(128); // Just in case something doesn't get faded.
|
||||
|
||||
@ -7414,7 +7085,7 @@ uint16_t mode_rocktaves(void) { // Rocktaves. Same note from eac
|
||||
|
||||
return FRAMETIME;
|
||||
} // mode_rocktaves()
|
||||
static const char *_data_FX_MODE_ROCKTAVES PROGMEM = " ♫ Rocktaves@;,!;!;mp12=0,ssim=1"; // Pixels, Beatsin
|
||||
static const char *_data_FX_MODE_ROCKTAVES PROGMEM = "Rocktaves ♫@;,!;!;mp12=0,ssim=1"; // Pixels, Beatsin
|
||||
|
||||
|
||||
///////////////////////
|
||||
@ -7429,23 +7100,23 @@ uint16_t mode_waterfall(void) { // Waterfall. By: Andrew Tulin
|
||||
// add support for no audio data
|
||||
um_data = simulateSound(SEGMENT.soundSim);
|
||||
}
|
||||
float sampleAvg = *(float*)um_data->u_data[0];
|
||||
float sampleAvg = *(float*) um_data->u_data[0];
|
||||
uint8_t soundAgc = *(uint8_t*)um_data->u_data[1];
|
||||
uint8_t samplePeak = *(uint8_t*)um_data->u_data[5];
|
||||
float FFT_MajorPeak = *(float*)um_data->u_data[6];
|
||||
float FFT_Magnitude = *(float*)um_data->u_data[7];
|
||||
uint8_t maxVol = *(uint8_t*)um_data->u_data[9];
|
||||
uint8_t binNum = *(uint8_t*)um_data->u_data[10];
|
||||
float multAgc = *(float*)um_data->u_data[11];
|
||||
float FFT_MajorPeak = *(float*) um_data->u_data[6];
|
||||
float FFT_Magnitude = *(float*) um_data->u_data[7];
|
||||
uint8_t *maxVol = (uint8_t*)um_data->u_data[9];
|
||||
uint8_t *binNum = (uint8_t*)um_data->u_data[10];
|
||||
float multAgc = *(float*) um_data->u_data[11];
|
||||
|
||||
if (SEGENV.call == 0) {
|
||||
SEGENV.aux0 = 255;
|
||||
SEGMENT.custom2 = binNum;
|
||||
SEGMENT.custom3 = maxVol * 2;
|
||||
SEGMENT.custom2 = *binNum;
|
||||
SEGMENT.custom3 = *maxVol * 2;
|
||||
}
|
||||
|
||||
binNum = SEGMENT.custom2; // Select a bin.
|
||||
maxVol = SEGMENT.custom3/2; // Our volume comparator.
|
||||
*binNum = SEGMENT.custom2; // Select a bin.
|
||||
*maxVol = SEGMENT.custom3/2; // Our volume comparator.
|
||||
|
||||
uint8_t secondHand = micros() / (256-SEGMENT.speed)/500 + 1 % 16;
|
||||
if (SEGENV.aux0 != secondHand) { // Triggered millis timing.
|
||||
@ -7467,7 +7138,7 @@ uint16_t mode_waterfall(void) { // Waterfall. By: Andrew Tulin
|
||||
|
||||
return FRAMETIME;
|
||||
} // mode_waterfall()
|
||||
static const char *_data_FX_MODE_WATERFALL PROGMEM = " ♫ Waterfall@!,Adjust color,,Select bin, Volume (minimum)=0;!,!;!;mp12=2,ssim=1"; // Circles, Beatsin
|
||||
static const char *_data_FX_MODE_WATERFALL PROGMEM = "Waterfall ♫@!,Adjust color,,Select bin, Volume (minimum)=0;!,!;!;mp12=2,ssim=1"; // Circles, Beatsin
|
||||
|
||||
|
||||
#ifndef WLED_DISABLE_2D
|
||||
@ -7524,7 +7195,7 @@ uint16_t mode_2DGEQ(void) { // By Will Tatam. Code reduction by Ewoud Wijma.
|
||||
|
||||
return FRAMETIME;
|
||||
} // mode_2DGEQ()
|
||||
static const char *_data_FX_MODE_2DGEQ PROGMEM = " ♫ 2D GEQ@Fade speed,Ripple decay,# of bands=255,Color bars=64;!,,Peak Color;!=11;ssim=1"; // Beatsin
|
||||
static const char *_data_FX_MODE_2DGEQ PROGMEM = "2D GEQ ♫@Fade speed,Ripple decay,# of bands=255,Color bars=64;!,,Peak Color;!=11;ssim=1"; // Beatsin
|
||||
|
||||
|
||||
/////////////////////////
|
||||
@ -7584,7 +7255,7 @@ uint16_t mode_2DFunkyPlank(void) { // Written by ??? Adapted by Wil
|
||||
SEGMENT.setPixels(leds);
|
||||
return FRAMETIME;
|
||||
} // mode_2DFunkyPlank
|
||||
static const char *_data_FX_MODE_2DFUNKYPLANK PROGMEM = " ♫ 2D Funky Plank@Scroll speed,,# of bands;;;ssim=1"; // Beatsin
|
||||
static const char *_data_FX_MODE_2DFUNKYPLANK PROGMEM = "2D Funky Plank ♫@Scroll speed,,# of bands;;;ssim=1"; // Beatsin
|
||||
|
||||
#endif // WLED_DISABLE_2D
|
||||
|
||||
@ -7911,7 +7582,6 @@ void WS2812FX::setupEffectData() {
|
||||
addEffect(FX_MODE_2DGEQ, &mode_2DGEQ, _data_FX_MODE_2DGEQ);
|
||||
addEffect(FX_MODE_WATERFALL, &mode_waterfall, _data_FX_MODE_WATERFALL);
|
||||
addEffect(FX_MODE_FREQPIXELS, &mode_freqpixels, _data_FX_MODE_FREQPIXELS);
|
||||
addEffect(FX_MODE_BINMAP, &mode_binmap, _data_FX_MODE_BINMAP);
|
||||
addEffect(FX_MODE_NOISEFIRE, &mode_noisefire, _data_FX_MODE_NOISEFIRE);
|
||||
addEffect(FX_MODE_PUDDLEPEAK, &mode_puddlepeak, _data_FX_MODE_PUDDLEPEAK);
|
||||
addEffect(FX_MODE_NOISEMOVE, &mode_noisemove, _data_FX_MODE_NOISEMOVE);
|
||||
|
@ -284,11 +284,11 @@ uint16_t Segment::virtualLength() {
|
||||
uint32_t vLen = vW * vH; // use all pixels from segment
|
||||
switch (map1D2D) {
|
||||
case M12_VerticalBar:
|
||||
vLen = vW;
|
||||
vLen = vW; // segment width since it is used in getPixelColor()
|
||||
break;
|
||||
case M12_Circle:
|
||||
case M12_Block:
|
||||
vLen = (vW + vH) / 2; // take half of the average width
|
||||
case M12_Circle:
|
||||
vLen = max(vW,vH); // get the longest dimension
|
||||
break;
|
||||
}
|
||||
return vLen;
|
||||
@ -317,7 +317,7 @@ void IRAM_ATTR Segment::setPixelColor(int i, uint32_t col)
|
||||
break;
|
||||
case M12_Circle:
|
||||
// expand in circular fashion from center
|
||||
for (float degrees = 0; degrees <= 90; degrees += 90.0f / (4*i+1)) { // this may prove too many iterations on larger matrices
|
||||
for (float degrees = 0.0f; degrees <= 90.0f; degrees += 89.99f / (sqrtf((float)max(vH,vW))*i+1)) { // this may prove too many iterations on larger matrices
|
||||
// may want to try float version as well (with or without antialiasing)
|
||||
int x = roundf(sin_t(degrees*DEG_TO_RAD) * i);
|
||||
int y = roundf(cos_t(degrees*DEG_TO_RAD) * i);
|
||||
@ -405,17 +405,19 @@ uint32_t Segment::getPixelColor(uint16_t i)
|
||||
{
|
||||
#ifndef WLED_DISABLE_2D
|
||||
if (height() > 1) { // if this does not work use strip.isMatrix
|
||||
//uint16_t vH = virtualHeight(); // segment height in logical pixels
|
||||
uint16_t vH = virtualHeight(); // segment height in logical pixels
|
||||
uint16_t vW = virtualWidth();
|
||||
switch (map1D2D) {
|
||||
case M12_Pixels:
|
||||
return getPixelColorXY(i % vW, i / vW);
|
||||
break;
|
||||
case M12_VerticalBar:
|
||||
return getPixelColorXY(i, 0);
|
||||
break;
|
||||
case M12_Circle:
|
||||
case M12_Block:
|
||||
// only use 1st row
|
||||
return getPixelColorXY(i, 0);
|
||||
// use longest dimension
|
||||
return vW>vH ? getPixelColorXY(i, 0) : getPixelColorXY(0, i);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
|
@ -827,13 +827,13 @@ input[type=range]::-moz-range-thumb {
|
||||
}
|
||||
|
||||
select {
|
||||
padding: 4px 0 4px 8px;
|
||||
padding: 4px 8px;
|
||||
margin: 0;
|
||||
font-size: 19px;
|
||||
background-color: var(--c-3);
|
||||
color: var(--c-d);
|
||||
cursor: pointer;
|
||||
border: 1px solid var(--c-2);
|
||||
border: 0 solid var(--c-2);
|
||||
border-radius: 20px;
|
||||
transition-duration: 0.5s;
|
||||
-webkit-backface-visibility: hidden;
|
||||
@ -842,6 +842,7 @@ select {
|
||||
-moz-appearance: none;
|
||||
backface-visibility: hidden;
|
||||
transform:translate3d(0,0,0);
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
#tt {
|
||||
text-align: center;
|
||||
|
@ -605,7 +605,7 @@ function parseInfo(i) {
|
||||
mh = i.leds.matrix ? i.leds.matrix.h : 0;
|
||||
isM = mw>0 && mh>0;
|
||||
if (!isM) hideModes("2D ");
|
||||
if (!i.u || !i.u.AudioReactive) { /*hideModes("♪ ");*/ hideModes("♫ "); } // hide /*audio*/ frequency reactive effects
|
||||
//if (!i.u || !i.u.AudioReactive) { /*hideModes(" ♪");*/ hideModes(" ♫"); } // hide /*audio*/ frequency reactive effects
|
||||
}
|
||||
|
||||
//https://stackoverflow.com/questions/2592092/executing-script-elements-inserted-with-innerhtml
|
||||
@ -707,11 +707,10 @@ function populateSegments(s)
|
||||
</div>`;
|
||||
let sndSim = `<div data-snd="ssim" class="lbl-s hide">Sound sim<br>
|
||||
<div class="sel-p"><select class="sel-p" id="seg${i}ssim" onchange="setSSim(${i})">
|
||||
<option value="0" ${inst.ssim==0?' selected':''}>Off</option>
|
||||
<option value="1" ${inst.ssim==1?' selected':''}>BeatSin</option>
|
||||
<option value="2" ${inst.ssim==2?' selected':''}>WeWillRockYou</option>
|
||||
<option value="3" ${inst.ssim==3?' selected':''}>U10_3</option>
|
||||
<option value="4" ${inst.ssim==4?' selected':''}>U14_3</option>
|
||||
<option value="0" ${inst.ssim==0?' selected':''}>BeatSin</option>
|
||||
<option value="1" ${inst.ssim==1?' selected':''}>WeWillRockYou</option>
|
||||
<option value="2" ${inst.ssim==2?' selected':''}>U10_3</option>
|
||||
<option value="3" ${inst.ssim==3?' selected':''}>U14_3</option>
|
||||
</select></div>
|
||||
</div>`;
|
||||
cn += `<div class="seg lstI ${i==s.mainseg ? 'selected' : ''} ${exp ? "expanded":""}" id="seg${i}">
|
||||
@ -1143,7 +1142,7 @@ function updateSelectedFx()
|
||||
var segs = gId("segcont").querySelectorAll(`div[data-map="map2D"]`);
|
||||
for (const seg of segs) if (selectedName.indexOf("2D ")<0) seg.classList.remove("hide"); else seg.classList.add("hide");
|
||||
var segs = gId("segcont").querySelectorAll(`div[data-snd="ssim"]`);
|
||||
for (const seg of segs) if (selectedName.indexOf("♪ ")<0 && selectedName.indexOf("♫ ")<0) seg.classList.add("hide"); else seg.classList.remove("hide"); // also "♫ "?
|
||||
for (const seg of segs) if (selectedName.indexOf(" ♪")<0 && selectedName.indexOf(" ♫")<0) seg.classList.add("hide"); else seg.classList.remove("hide"); // also "♫ "?
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -327,6 +327,7 @@ uint8_t extractModeName(uint8_t mode, const char *src, char *dest, uint8_t maxLe
|
||||
uint8_t extractModeSlider(uint8_t mode, uint8_t slider, char *dest, uint8_t maxLen, uint8_t *var = nullptr);
|
||||
int16_t extractModeDefaults(uint8_t mode, const char *segVar);
|
||||
uint16_t crc16(const unsigned char* data_p, size_t length);
|
||||
um_data_t* simulateSound(uint8_t simulationId);
|
||||
|
||||
//wled_eeprom.cpp
|
||||
void applyMacro(byte index);
|
||||
|
@ -281,72 +281,6 @@ const uint8_t PAGE_liveviewws[] PROGMEM = {
|
||||
};
|
||||
|
||||
|
||||
// Autogenerated from wled00/data/liveviewws2D.htm, do not edit!!
|
||||
const uint16_t PAGE_liveviewws2D_length = 960;
|
||||
const uint8_t PAGE_liveviewws2D[] PROGMEM = {
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x13, 0x7d, 0x55, 0x61, 0x6f, 0xdb, 0x36,
|
||||
0x10, 0xfd, 0xee, 0x5f, 0xa1, 0x32, 0x4d, 0x4b, 0xd5, 0x8a, 0x24, 0x3b, 0xc8, 0x5a, 0xc8, 0x92,
|
||||
0x8b, 0x35, 0xf5, 0x87, 0x0e, 0xd9, 0x6a, 0x20, 0xdd, 0x82, 0x21, 0x08, 0x50, 0x4a, 0x3a, 0x5b,
|
||||
0x5c, 0x24, 0x52, 0x23, 0x29, 0x2b, 0x86, 0xa1, 0xff, 0xbe, 0xa3, 0xe4, 0x38, 0x4e, 0xba, 0xcd,
|
||||
0x1f, 0x24, 0x51, 0x77, 0x7a, 0xef, 0xdd, 0x3b, 0xf2, 0x1c, 0xbf, 0xfa, 0xfc, 0xf5, 0xf2, 0xdb,
|
||||
0x9f, 0xcb, 0x85, 0x53, 0x98, 0xaa, 0x9c, 0xc7, 0xfb, 0x2b, 0xb0, 0x7c, 0x1e, 0x57, 0x60, 0x98,
|
||||
0x23, 0x58, 0x05, 0x09, 0xd9, 0x70, 0x68, 0x6b, 0xa9, 0x0c, 0x71, 0x46, 0x99, 0x14, 0x06, 0x84,
|
||||
0x49, 0x48, 0xcb, 0x73, 0x53, 0x24, 0x39, 0x6c, 0x78, 0x06, 0x67, 0xfd, 0xc2, 0xe3, 0x82, 0x1b,
|
||||
0xce, 0xca, 0x33, 0x9d, 0xb1, 0x12, 0x92, 0x89, 0x57, 0xe1, 0x8b, 0xaa, 0xa9, 0x1e, 0xd7, 0x64,
|
||||
0x8f, 0x39, 0xca, 0x0a, 0xa6, 0x34, 0x20, 0x46, 0x63, 0x56, 0x67, 0x1f, 0xc8, 0x33, 0x2a, 0x53,
|
||||
0x40, 0x05, 0x67, 0x99, 0x2c, 0xa5, 0x22, 0xce, 0x81, 0xec, 0x64, 0xda, 0xff, 0x30, 0xd5, 0x70,
|
||||
0x53, 0xc2, 0x7c, 0x74, 0x73, 0xb5, 0xf8, 0xec, 0x5c, 0xf1, 0x0d, 0x38, 0x4b, 0x05, 0x56, 0x5e,
|
||||
0x1c, 0x0c, 0x91, 0x58, 0x9b, 0xad, 0x4d, 0x48, 0x65, 0xbe, 0xdd, 0x55, 0x4c, 0xad, 0xb9, 0x88,
|
||||
0xc2, 0xee, 0x24, 0x63, 0x62, 0x33, 0xf1, 0xfa, 0xdb, 0x74, 0x97, 0xb2, 0xec, 0x7e, 0xad, 0x64,
|
||||
0x23, 0xf2, 0xe8, 0x24, 0x0c, 0xc3, 0xd9, 0x8a, 0x97, 0x06, 0x54, 0x94, 0x2a, 0xbe, 0x2e, 0x8c,
|
||||
0x00, 0xad, 0xe9, 0xe4, 0xfd, 0xc5, 0xa9, 0x3b, 0xeb, 0xab, 0x8a, 0x26, 0x61, 0x78, 0x3a, 0x2b,
|
||||
0xc0, 0xc6, 0x86, 0xe7, 0x5a, 0x6a, 0xac, 0x53, 0x8a, 0x88, 0xa5, 0x5a, 0x96, 0x8d, 0x81, 0x6e,
|
||||
0x14, 0x07, 0x03, 0x6d, 0x1c, 0x0c, 0xde, 0x59, 0xf6, 0x79, 0x9c, 0xf3, 0x8d, 0xd3, 0xbf, 0x4f,
|
||||
0xc8, 0x5e, 0x09, 0x6b, 0x8c, 0xc4, 0x22, 0xac, 0x0c, 0xa6, 0x1d, 0x9e, 0x27, 0xa4, 0xc4, 0x1a,
|
||||
0xac, 0xfe, 0xcb, 0xfe, 0x15, 0x1a, 0x3c, 0xf8, 0x4a, 0xce, 0xa7, 0x21, 0x71, 0x3c, 0x67, 0xe0,
|
||||
0xdd, 0x2f, 0xf7, 0x58, 0xa9, 0x54, 0x39, 0xca, 0x9d, 0xd4, 0x0f, 0x0e, 0xf2, 0xf3, 0xdc, 0xb1,
|
||||
0x45, 0x90, 0xb9, 0x75, 0xe3, 0x8f, 0xde, 0x89, 0x01, 0x1e, 0xc5, 0xa0, 0x80, 0xf9, 0x28, 0xd6,
|
||||
0x99, 0xe2, 0xb5, 0x99, 0x8f, 0x36, 0x4c, 0x39, 0xad, 0xf6, 0x86, 0x68, 0x92, 0xcb, 0xac, 0xa9,
|
||||
0xd0, 0x5c, 0x7f, 0x0d, 0x66, 0x51, 0x82, 0x7d, 0xfc, 0xb4, 0xfd, 0x92, 0xd3, 0x97, 0x8a, 0x5c,
|
||||
0xaf, 0x84, 0x5c, 0x27, 0x84, 0x78, 0x15, 0x33, 0x8a, 0x3f, 0xdc, 0xf4, 0xfa, 0x42, 0xaf, 0xe6,
|
||||
0x0f, 0x50, 0xea, 0x25, 0xa8, 0x2b, 0xc8, 0x93, 0x70, 0xc6, 0x57, 0x74, 0x00, 0xb6, 0x78, 0x97,
|
||||
0xb6, 0x6f, 0x0f, 0xc6, 0xdd, 0x59, 0xca, 0xcc, 0x3c, 0x24, 0x3f, 0x84, 0x28, 0x99, 0xe6, 0xc4,
|
||||
0x9d, 0xad, 0x1a, 0x91, 0x59, 0x2b, 0x9d, 0x5c, 0xb1, 0x16, 0x81, 0x2e, 0xb9, 0xca, 0x4a, 0xd0,
|
||||
0x14, 0x3c, 0xe3, 0x71, 0x4f, 0x78, 0xda, 0x53, 0xee, 0x0e, 0x01, 0x7c, 0x6c, 0x51, 0x79, 0xdd,
|
||||
0x97, 0xff, 0x5d, 0xad, 0x53, 0xfa, 0x7a, 0xc7, 0x3b, 0xef, 0xf5, 0x4e, 0xd8, 0x8b, 0xee, 0xdc,
|
||||
0xef, 0x9e, 0xcd, 0x49, 0x01, 0x2d, 0x5e, 0x32, 0x53, 0x50, 0xb7, 0x5f, 0x33, 0x95, 0x51, 0x78,
|
||||
0x77, 0xac, 0x73, 0x7c, 0xbc, 0x08, 0xa6, 0x9e, 0xf9, 0xdf, 0xe8, 0x8b, 0x65, 0xe8, 0x4d, 0xdf,
|
||||
0xfd, 0x8a, 0xe8, 0xfe, 0xf2, 0xcb, 0x80, 0x6f, 0x35, 0x51, 0xb7, 0x3b, 0xd4, 0x50, 0x33, 0x2e,
|
||||
0x0c, 0xe6, 0x6a, 0xea, 0xee, 0x56, 0x52, 0x51, 0x9e, 0x4c, 0x67, 0x3c, 0xb6, 0xee, 0xf9, 0x25,
|
||||
0x88, 0xb5, 0x29, 0x66, 0x7c, 0x9c, 0x9c, 0xbb, 0xbb, 0x12, 0x8c, 0x03, 0x09, 0xe5, 0x67, 0x53,
|
||||
0x37, 0x38, 0x9f, 0xbd, 0xac, 0xfc, 0xf4, 0xc8, 0x66, 0xaf, 0xe7, 0x5b, 0x95, 0x12, 0xd1, 0x20,
|
||||
0x38, 0x0a, 0x0c, 0x4d, 0xb9, 0xe5, 0x77, 0xfb, 0xfb, 0x78, 0x72, 0x78, 0x9a, 0xde, 0x79, 0xd3,
|
||||
0x8b, 0x0b, 0xb7, 0xeb, 0x9e, 0x84, 0x35, 0x75, 0xce, 0x0c, 0xec, 0x0f, 0x0a, 0x05, 0xab, 0x00,
|
||||
0x3b, 0x0a, 0xcf, 0x1a, 0xda, 0x33, 0xe9, 0xbf, 0x95, 0xa1, 0xf4, 0x48, 0x71, 0x2f, 0xd1, 0x7d,
|
||||
0xde, 0xeb, 0x7d, 0x2f, 0xfb, 0x7d, 0x7a, 0xac, 0xc9, 0x3b, 0xaa, 0xff, 0x89, 0x1b, 0x5b, 0x6e,
|
||||
0x37, 0xe6, 0x2f, 0x5a, 0x0a, 0xcb, 0x6c, 0xd4, 0x76, 0x87, 0x5b, 0x85, 0xdc, 0xca, 0xf4, 0x2f,
|
||||
0xc8, 0x8c, 0xf3, 0xb3, 0x52, 0x6c, 0xfb, 0xa9, 0x59, 0xad, 0x40, 0xdd, 0x91, 0x24, 0x49, 0x8c,
|
||||
0xbc, 0x46, 0x40, 0xb1, 0xf6, 0x71, 0x64, 0x94, 0x14, 0x7c, 0x14, 0xce, 0xdc, 0x47, 0xcb, 0x04,
|
||||
0xb4, 0xce, 0xef, 0xc8, 0xf1, 0xa1, 0xff, 0x8a, 0xc2, 0xc6, 0x6e, 0xdf, 0x3e, 0xc3, 0x6e, 0xbf,
|
||||
0xf7, 0x3f, 0xbd, 0x4a, 0xe0, 0x36, 0xbc, 0x73, 0x15, 0x98, 0x46, 0x89, 0xd9, 0xcb, 0xaa, 0xbb,
|
||||
0x2e, 0x63, 0x26, 0x2b, 0xac, 0x0a, 0x9c, 0x2b, 0x78, 0x72, 0xc0, 0x07, 0xa5, 0xd0, 0x59, 0xb2,
|
||||
0x04, 0xb8, 0x77, 0x6e, 0xae, 0x9d, 0x7e, 0x19, 0x11, 0xcf, 0xe6, 0x5a, 0xa1, 0xad, 0x46, 0x3d,
|
||||
0x35, 0x56, 0x2a, 0x72, 0xd9, 0xfa, 0xad, 0x7e, 0x02, 0xe8, 0x5a, 0xfd, 0xe6, 0x4d, 0xab, 0x7d,
|
||||
0x85, 0xa7, 0x7d, 0x7b, 0x6d, 0x90, 0x07, 0xb5, 0xdf, 0x40, 0x7a, 0x2d, 0xb3, 0x7b, 0x30, 0xfe,
|
||||
0xd7, 0xe5, 0xe2, 0xb7, 0x8f, 0xf4, 0x91, 0x85, 0x8b, 0x95, 0xdc, 0x93, 0x34, 0x1a, 0xb4, 0x83,
|
||||
0x98, 0xc8, 0x86, 0x07, 0x0b, 0x01, 0x34, 0x08, 0x3c, 0x72, 0xbb, 0xb7, 0xe5, 0xe6, 0x6d, 0x64,
|
||||
0x54, 0x03, 0x1d, 0x71, 0xdd, 0xe8, 0xdf, 0xbe, 0x44, 0x79, 0xb2, 0x06, 0x81, 0xd6, 0xe0, 0x87,
|
||||
0x14, 0x95, 0x59, 0x33, 0x0e, 0x8c, 0x94, 0x92, 0xc2, 0x98, 0x5a, 0x47, 0xe8, 0xe1, 0x5e, 0x6e,
|
||||
0x29, 0x51, 0x2d, 0x76, 0xc0, 0xaf, 0x95, 0x34, 0x12, 0x07, 0xea, 0x47, 0xd2, 0x6a, 0x4d, 0x22,
|
||||
0xbc, 0x12, 0x77, 0x4c, 0xa2, 0x20, 0x20, 0xe3, 0xc3, 0x0c, 0x38, 0x24, 0x17, 0x52, 0x9b, 0x31,
|
||||
0x09, 0x6c, 0x8e, 0xeb, 0x4b, 0x61, 0x29, 0x93, 0xc7, 0x5e, 0xd2, 0x27, 0xe3, 0x7e, 0x14, 0xf6,
|
||||
0x9f, 0xe5, 0x74, 0x7d, 0x20, 0xe5, 0x82, 0xa9, 0xed, 0xb7, 0x6d, 0x8d, 0xf3, 0x8b, 0xd9, 0xee,
|
||||
0xa5, 0x7d, 0xcf, 0x89, 0x8d, 0xb1, 0x3c, 0x5f, 0xd8, 0x56, 0x5e, 0x71, 0x8d, 0xd3, 0x1e, 0xb0,
|
||||
0x21, 0x15, 0xce, 0x60, 0xb6, 0x06, 0xe2, 0x1d, 0xed, 0x1e, 0xd7, 0x0e, 0xd9, 0x61, 0x92, 0xc5,
|
||||
0xc1, 0x30, 0x5f, 0x83, 0xfe, 0xef, 0xea, 0x1f, 0xaa, 0x8c, 0x74, 0x8d, 0xc4, 0x06, 0x00, 0x00
|
||||
};
|
||||
|
||||
|
||||
// Autogenerated from wled00/data/404.htm, do not edit!!
|
||||
const uint16_t PAGE_404_length = 868;
|
||||
const uint8_t PAGE_404[] PROGMEM = {
|
||||
|
3583
wled00/html_ui.h
3583
wled00/html_ui.h
File diff suppressed because it is too large
Load Diff
@ -172,20 +172,20 @@ void deserializeSegment(JsonObject elem, byte it, byte presetId)
|
||||
#endif
|
||||
|
||||
byte fx = seg.mode;
|
||||
if (getVal(elem["fx"], &fx, 1, strip.getModeCount())) { //load effect ('r' random, '~' inc/dec, 1-255 exact value)
|
||||
if (getVal(elem["fx"], &fx, 0, strip.getModeCount())) { //load effect ('r' random, '~' inc/dec, 0-255 exact value)
|
||||
if (!presetId && currentPlaylist>=0) unloadPlaylist();
|
||||
strip.setMode(id, fx);
|
||||
}
|
||||
|
||||
if (fx != seg.mode) {
|
||||
//seg.startTransition(strip.getTransition()); // set effect transitions
|
||||
seg.markForReset();
|
||||
seg.mode = fx;
|
||||
// load default values from effect string if effect is selected without
|
||||
// any other effect parameter (i.e. effect clicked in UI)
|
||||
if (!elem["fx"].isNull() // effect must not be empty
|
||||
&& elem[F("sx")].isNull()
|
||||
if ( elem[F("sx")].isNull()
|
||||
&& elem[F("ix")].isNull()
|
||||
&& elem["pal"].isNull()
|
||||
&& elem[F("c1")].isNull()
|
||||
&& elem[F("c2")].isNull()
|
||||
&& elem[F("c3")].isNull())
|
||||
&& elem[F("c3")].isNull() )
|
||||
{
|
||||
// compatibility mode begin
|
||||
char buf[5]; // dummy buffer
|
||||
@ -216,6 +216,8 @@ void deserializeSegment(JsonObject elem, byte it, byte presetId)
|
||||
sOpt = extractModeDefaults(fx, SET_F("rY")); if (sOpt >= 0) seg.reverse_y = (bool)sOpt; // setOption(SEG_OPTION_REVERSED_Y, (bool)sOpt); // NOTE: setting this option is a risky business
|
||||
sOpt = extractModeDefaults(fx, SET_F("mY")); if (sOpt >= 0) seg.mirror_y = (bool)sOpt; // setOption(SEG_OPTION_MIRROR_Y, (bool)sOpt); // NOTE: setting this option is a risky business
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//getVal also supports inc/decrementing and random
|
||||
getVal(elem[F("sx")], &seg.speed);
|
||||
|
151
wled00/util.cpp
151
wled00/util.cpp
@ -381,3 +381,154 @@ uint16_t crc16(const unsigned char* data_p, size_t length) {
|
||||
}
|
||||
return crc;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Begin simulateSound (to enable audio enhanced effects to display something)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Currently 4 types defined, to be fine tuned and new types added
|
||||
typedef enum UM_SoundSimulations {
|
||||
UMS_BeatSin = 0,
|
||||
UMS_WeWillRockYou,
|
||||
UMS_10_3,
|
||||
UMS_14_3
|
||||
} um_soundSimulations_t;
|
||||
|
||||
// this is still work in progress
|
||||
um_data_t* simulateSound(uint8_t simulationId)
|
||||
{
|
||||
static float sampleAvg;
|
||||
static uint8_t soundAgc;
|
||||
static float sampleAgc;
|
||||
static int16_t sampleRaw;
|
||||
static int16_t rawSampleAgc;
|
||||
static uint8_t samplePeak;
|
||||
static float FFT_MajorPeak;
|
||||
static float FFT_Magnitude;
|
||||
static uint8_t maxVol;
|
||||
static uint8_t binNum;
|
||||
static float multAgc;
|
||||
|
||||
float sampleGain;
|
||||
uint8_t soundSquelch;
|
||||
uint8_t inputLevel;
|
||||
|
||||
//arrays
|
||||
uint8_t *fftResult;
|
||||
uint8_t *myVals;
|
||||
float *fftBin;
|
||||
|
||||
static um_data_t* um_data = nullptr;
|
||||
|
||||
if (!um_data) {
|
||||
//claim storage for arrays
|
||||
fftResult = (uint8_t *)malloc(sizeof(uint8_t) * 16);
|
||||
myVals = (uint8_t *)malloc(sizeof(uint8_t) * 32);
|
||||
fftBin = (float *)malloc(sizeof(float) * 256); // not used (for debugging purposes)
|
||||
|
||||
// initialize um_data pointer structure
|
||||
// NOTE!!!
|
||||
// This may change as AudioReactive usermod may change
|
||||
um_data = new um_data_t;
|
||||
um_data->u_size = 18;
|
||||
um_data->u_type = new um_types_t[um_data->u_size];
|
||||
um_data->u_data = new void*[um_data->u_size];
|
||||
um_data->u_data[ 0] = &sampleAvg;
|
||||
um_data->u_data[ 1] = &soundAgc;
|
||||
um_data->u_data[ 2] = &sampleAgc;
|
||||
um_data->u_data[ 3] = &sampleRaw;
|
||||
um_data->u_data[ 4] = &rawSampleAgc;
|
||||
um_data->u_data[ 5] = &samplePeak;
|
||||
um_data->u_data[ 6] = &FFT_MajorPeak;
|
||||
um_data->u_data[ 7] = &FFT_Magnitude;
|
||||
um_data->u_data[ 8] = fftResult;
|
||||
um_data->u_data[ 9] = &maxVol;
|
||||
um_data->u_data[10] = &binNum;
|
||||
um_data->u_data[11] = &multAgc;
|
||||
um_data->u_data[14] = myVals; //*used (only once, Pixels)
|
||||
um_data->u_data[13] = &sampleGain;
|
||||
um_data->u_data[15] = &soundSquelch;
|
||||
um_data->u_data[16] = fftBin; //only used in binmap
|
||||
um_data->u_data[17] = &inputLevel;
|
||||
} else {
|
||||
// get arrays from um_data
|
||||
fftResult = (uint8_t*)um_data->u_data[8];
|
||||
myVals = (uint8_t*)um_data->u_data[14];
|
||||
fftBin = (float*)um_data->u_data[16];
|
||||
}
|
||||
|
||||
uint32_t ms = millis();
|
||||
|
||||
switch (simulationId) {
|
||||
default:
|
||||
case UMS_BeatSin:
|
||||
for (int i = 0; i<16; i++)
|
||||
fftResult[i] = beatsin8(120 / (i+1), 0, 255);
|
||||
// fftResult[i] = (beatsin8(120, 0, 255) + (256/16 * i)) % 256;
|
||||
sampleAvg = fftResult[8];
|
||||
break;
|
||||
case UMS_WeWillRockYou:
|
||||
if (ms%2000 < 200) {
|
||||
sampleAvg = random8(255);
|
||||
for (int i = 0; i<5; i++)
|
||||
fftResult[i] = random8(255);
|
||||
}
|
||||
else if (ms%2000 < 400) {
|
||||
sampleAvg = 0;
|
||||
for (int i = 0; i<16; i++)
|
||||
fftResult[i] = 0;
|
||||
}
|
||||
else if (ms%2000 < 600) {
|
||||
sampleAvg = random8(255);
|
||||
for (int i = 5; i<11; i++)
|
||||
fftResult[i] = random8(255);
|
||||
}
|
||||
else if (ms%2000 < 800) {
|
||||
sampleAvg = 0;
|
||||
for (int i = 0; i<16; i++)
|
||||
fftResult[i] = 0;
|
||||
}
|
||||
else if (ms%2000 < 1000) {
|
||||
sampleAvg = random8(255);
|
||||
for (int i = 11; i<16; i++)
|
||||
fftResult[i] = random8(255);
|
||||
}
|
||||
else {
|
||||
sampleAvg = 0;
|
||||
for (int i = 0; i<16; i++)
|
||||
fftResult[i] = 0;
|
||||
}
|
||||
break;
|
||||
case UMS_10_3:
|
||||
for (int i = 0; i<16; i++)
|
||||
fftResult[i] = inoise8(beatsin8(90 / (i+1), 0, 200)*15 + (ms>>10), ms>>3);
|
||||
sampleAvg = fftResult[8];
|
||||
break;
|
||||
case UMS_14_3:
|
||||
for (int i = 0; i<16; i++)
|
||||
fftResult[i] = inoise8(beatsin8(120 / (i+1), 10, 30)*10 + (ms>>14), ms>>3);
|
||||
sampleAvg = fftResult[8];
|
||||
break;
|
||||
}
|
||||
|
||||
//derive other vars from sampleAvg
|
||||
|
||||
//sampleAvg = mapf(sampleAvg, 0, 255, 0, 255); // help me out here
|
||||
soundAgc = 0; //only avg in simulations
|
||||
sampleAgc = sampleAvg;
|
||||
sampleRaw = sampleAvg;
|
||||
sampleRaw = map(sampleRaw, 50, 190, 0, 224);
|
||||
rawSampleAgc = sampleAvg;
|
||||
samplePeak = random8() > 250;
|
||||
FFT_MajorPeak = sampleAvg;
|
||||
FFT_Magnitude = sampleAvg;
|
||||
multAgc = sampleAvg;
|
||||
myVals[millis()%32] = sampleAvg; // filling values semi randomly (why?)
|
||||
sampleGain = 40;
|
||||
soundSquelch = 10;
|
||||
maxVol = 10; // this gets feedback fro UI
|
||||
binNum = 8; // this gets feedback fro UI
|
||||
inputLevel = 128; // this gets feedback fro UI
|
||||
|
||||
return um_data;
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
// version code in format yymmddb (b = daily build)
|
||||
#define VERSION 2207241
|
||||
#define VERSION 2207251
|
||||
|
||||
//uncomment this if you have a "my_config.h" file you'd like to use
|
||||
//#define WLED_USE_MY_CONFIG
|
||||
|
Loading…
Reference in New Issue
Block a user