Revert "Merge branch 'segment-api' into origin/mapping12soundsim"
This reverts commit 8ef82ebdd7
.
This commit is contained in:
parent
8ef82ebdd7
commit
863212915c
@ -393,6 +393,12 @@ const char PAGE_dmxmap[] PROGMEM = R"=====()=====";
|
|||||||
method: "gzip",
|
method: "gzip",
|
||||||
filter: "html-minify",
|
filter: "html-minify",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
file: "liveviewws2D.htm",
|
||||||
|
name: "PAGE_liveviewws2D",
|
||||||
|
method: "gzip",
|
||||||
|
filter: "html-minify",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
file: "404.htm",
|
file: "404.htm",
|
||||||
name: "PAGE_404",
|
name: "PAGE_404",
|
||||||
|
420
wled00/FX.cpp
420
wled00/FX.cpp
@ -3377,7 +3377,7 @@ uint16_t mode_exploding_fireworks(void)
|
|||||||
return FRAMETIME;
|
return FRAMETIME;
|
||||||
}
|
}
|
||||||
#undef MAX_SPARKS
|
#undef MAX_SPARKS
|
||||||
static const char *_data_FX_MODE_EXPLODING_FIREWORKS PROGMEM = "Fireworks 1D/2D@Gravity,Firing side=128;!,!,;!=11";
|
static const char *_data_FX_MODE_EXPLODING_FIREWORKS PROGMEM = "Fireworks 1D@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
|
if (!SEGENV.allocateData(dataSize)) return mode_static(); //allocation failed
|
||||||
CRGB *leds = reinterpret_cast<CRGB*>(SEGENV.data);
|
CRGB *leds = reinterpret_cast<CRGB*>(SEGENV.data);
|
||||||
|
|
||||||
if (SEGENV.call == 0) SEGMENT.fill_solid(leds, CRGB::Black);
|
if (SEGENV.call == 0) SEGMENT.fill_solid(leds, 0);
|
||||||
|
|
||||||
SEGMENT.fadeToBlackBy(leds, 64);
|
SEGMENT.fadeToBlackBy(leds, 64);
|
||||||
|
|
||||||
@ -4687,7 +4687,7 @@ uint16_t mode_2Ddna(void) { // dna originally by by ldirko at https://pa
|
|||||||
SEGMENT.setPixels(leds);
|
SEGMENT.setPixels(leds);
|
||||||
return FRAMETIME;
|
return FRAMETIME;
|
||||||
} // mode_2Ddna()
|
} // mode_2Ddna()
|
||||||
static const char *_data_FX_MODE_2DDNA PROGMEM = "2D DNA@Scroll speed,Blur;1,2,3;!";
|
static const char *_data_FX_MODE_2DDNA PROGMEM = "2D DNA@Scroll speed,Blur;;!";
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////
|
/////////////////////////
|
||||||
@ -5996,12 +5996,195 @@ 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
|
inputLevel = (uint8_t*) um_data->u_data[17]; // requires UI element (SEGMENT.customX?), changes source element
|
||||||
} else {
|
} else {
|
||||||
// add support for no audio data
|
// add support for no audio data
|
||||||
um_data = simulateSound(SEGMENT.soundSim);
|
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);
|
||||||
}
|
}
|
||||||
if (!myVals || !fftBin || ...) return mode_static();
|
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 //
|
// * Ripple Peak //
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
@ -6074,7 +6257,7 @@ uint16_t mode_ripplepeak(void) { // * Ripple peak. By Andrew Tuli
|
|||||||
|
|
||||||
return FRAMETIME;
|
return FRAMETIME;
|
||||||
} // mode_ripplepeak()
|
} // 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
|
#ifndef WLED_DISABLE_2D
|
||||||
@ -6128,7 +6311,7 @@ uint16_t mode_2DSwirl(void) {
|
|||||||
SEGMENT.setPixels(leds);
|
SEGMENT.setPixels(leds);
|
||||||
return FRAMETIME;
|
return FRAMETIME;
|
||||||
} // mode_2DSwirl()
|
} // 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
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////
|
/////////////////////////
|
||||||
@ -6180,7 +6363,7 @@ uint16_t mode_2DWaverly(void) {
|
|||||||
SEGMENT.setPixels(leds);
|
SEGMENT.setPixels(leds);
|
||||||
return FRAMETIME;
|
return FRAMETIME;
|
||||||
} // mode_2DWaverly()
|
} // 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
|
#endif // WLED_DISABLE_2D
|
||||||
|
|
||||||
@ -6243,7 +6426,7 @@ uint16_t mode_gravcenter(void) { // Gravcenter. By Andrew Tuline.
|
|||||||
|
|
||||||
return FRAMETIME;
|
return FRAMETIME;
|
||||||
} // mode_gravcenter()
|
} // 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
|
||||||
|
|
||||||
|
|
||||||
///////////////////////
|
///////////////////////
|
||||||
@ -6297,12 +6480,13 @@ uint16_t mode_gravcentric(void) { // Gravcentric. By Andrew
|
|||||||
|
|
||||||
return FRAMETIME;
|
return FRAMETIME;
|
||||||
} // mode_gravcentric()
|
} // 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 //
|
// * GRAVIMETER //
|
||||||
///////////////////////
|
///////////////////////
|
||||||
|
#ifndef SR_DEBUG_AGC
|
||||||
uint16_t mode_gravimeter(void) { // Gravmeter. By Andrew Tuline.
|
uint16_t mode_gravimeter(void) { // Gravmeter. By Andrew Tuline.
|
||||||
|
|
||||||
uint16_t dataSize = sizeof(gravity);
|
uint16_t dataSize = sizeof(gravity);
|
||||||
@ -6346,7 +6530,74 @@ uint16_t mode_gravimeter(void) { // Gravmeter. By Andrew Tuline.
|
|||||||
|
|
||||||
return FRAMETIME;
|
return FRAMETIME;
|
||||||
} // mode_gravimeter()
|
} // mode_gravimeter()
|
||||||
static const char *_data_FX_MODE_GRAVIMETER PROGMEM = "Gravimeter ♪@Rate of fall,Sensitivity=128;,!;!;mp12=2,ssim=1"; // Circle, Beatsin
|
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
|
||||||
|
|
||||||
|
|
||||||
//////////////////////
|
//////////////////////
|
||||||
@ -6369,7 +6620,7 @@ uint16_t mode_juggles(void) { // Juggles. By Andrew Tuline.
|
|||||||
|
|
||||||
return FRAMETIME;
|
return FRAMETIME;
|
||||||
} // mode_juggles()
|
} // 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
|
||||||
|
|
||||||
|
|
||||||
//////////////////////
|
//////////////////////
|
||||||
@ -6399,7 +6650,7 @@ uint16_t mode_matripix(void) { // Matripix. By Andrew Tuline.
|
|||||||
|
|
||||||
return FRAMETIME;
|
return FRAMETIME;
|
||||||
} // mode_matripix()
|
} // 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
|
||||||
|
|
||||||
|
|
||||||
//////////////////////
|
//////////////////////
|
||||||
@ -6437,7 +6688,7 @@ uint16_t mode_midnoise(void) { // Midnoise. By Andrew Tuline.
|
|||||||
|
|
||||||
return FRAMETIME;
|
return FRAMETIME;
|
||||||
} // mode_midnoise()
|
} // 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
|
||||||
|
|
||||||
|
|
||||||
//////////////////////
|
//////////////////////
|
||||||
@ -6471,7 +6722,7 @@ uint16_t mode_noisefire(void) { // Noisefire. By Andrew Tuline.
|
|||||||
|
|
||||||
return FRAMETIME;
|
return FRAMETIME;
|
||||||
} // mode_noisefire()
|
} // 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
|
||||||
|
|
||||||
|
|
||||||
///////////////////////
|
///////////////////////
|
||||||
@ -6509,7 +6760,7 @@ uint16_t mode_noisemeter(void) { // Noisemeter. By Andrew Tuline.
|
|||||||
|
|
||||||
return FRAMETIME;
|
return FRAMETIME;
|
||||||
} // mode_noisemeter()
|
} // 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
|
||||||
|
|
||||||
|
|
||||||
//////////////////////
|
//////////////////////
|
||||||
@ -6542,7 +6793,7 @@ uint16_t mode_pixelwave(void) { // Pixelwave. By Andrew Tuline.
|
|||||||
|
|
||||||
return FRAMETIME;
|
return FRAMETIME;
|
||||||
} // mode_pixelwave()
|
} // 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
|
||||||
|
|
||||||
|
|
||||||
//////////////////////
|
//////////////////////
|
||||||
@ -6586,7 +6837,7 @@ uint16_t mode_plasmoid(void) { // Plasmoid. By Andrew Tuline.
|
|||||||
|
|
||||||
return FRAMETIME;
|
return FRAMETIME;
|
||||||
} // mode_plasmoid()
|
} // 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
|
||||||
|
|
||||||
|
|
||||||
///////////////////////
|
///////////////////////
|
||||||
@ -6606,16 +6857,16 @@ uint16_t mode_puddlepeak(void) { // Puddlepeak. By Andrew Tuline.
|
|||||||
}
|
}
|
||||||
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 samplePeak = *(uint8_t*)um_data->u_data[5];
|
||||||
uint8_t *maxVol = (uint8_t*)um_data->u_data[9];
|
uint8_t maxVol = *(uint8_t*)um_data->u_data[9];
|
||||||
uint8_t *binNum = (uint8_t*)um_data->u_data[10];
|
uint8_t binNum = *(uint8_t*)um_data->u_data[10];
|
||||||
|
|
||||||
if (SEGENV.call == 0) {
|
if (SEGENV.call == 0) {
|
||||||
SEGMENT.custom2 = *binNum;
|
SEGMENT.custom2 = binNum;
|
||||||
SEGMENT.custom3 = *maxVol * 2;
|
SEGMENT.custom3 = maxVol * 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
*binNum = SEGMENT.custom2; // Select a bin.
|
binNum = SEGMENT.custom2; // Select a bin.
|
||||||
*maxVol = SEGMENT.custom3/4; // Our volume comparator.
|
maxVol = SEGMENT.custom3/4; // Our volume comparator.
|
||||||
|
|
||||||
SEGMENT.fade_out(fadeVal);
|
SEGMENT.fade_out(fadeVal);
|
||||||
|
|
||||||
@ -6630,7 +6881,7 @@ uint16_t mode_puddlepeak(void) { // Puddlepeak. By Andrew Tuline.
|
|||||||
|
|
||||||
return FRAMETIME;
|
return FRAMETIME;
|
||||||
} // mode_puddlepeak()
|
} // 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
|
||||||
|
|
||||||
|
|
||||||
//////////////////////
|
//////////////////////
|
||||||
@ -6665,7 +6916,7 @@ uint16_t mode_puddles(void) { // Puddles. By Andrew Tuline.
|
|||||||
|
|
||||||
return FRAMETIME;
|
return FRAMETIME;
|
||||||
} // mode_puddles()
|
} // 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
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
@ -6695,13 +6946,92 @@ uint16_t mode_pixels(void) { // Pixels. By Andrew Tuline.
|
|||||||
|
|
||||||
return FRAMETIME;
|
return FRAMETIME;
|
||||||
} // mode_pixels()
|
} // 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 //
|
// 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 //
|
// ** Blurz //
|
||||||
@ -6730,7 +7060,7 @@ uint16_t mode_blurz(void) { // Blurz. By Andrew Tuline.
|
|||||||
|
|
||||||
return FRAMETIME;
|
return FRAMETIME;
|
||||||
} // mode_blurz()
|
} // 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
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////
|
/////////////////////////
|
||||||
@ -6767,7 +7097,7 @@ uint16_t mode_DJLight(void) { // Written by ??? Adapted by Wil
|
|||||||
|
|
||||||
return FRAMETIME;
|
return FRAMETIME;
|
||||||
} // mode_DJLight()
|
} // 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
|
||||||
|
|
||||||
|
|
||||||
////////////////////
|
////////////////////
|
||||||
@ -6804,7 +7134,7 @@ uint16_t mode_freqmap(void) { // Map FFT_MajorPeak to SEGLEN.
|
|||||||
|
|
||||||
return FRAMETIME;
|
return FRAMETIME;
|
||||||
} // mode_freqmap()
|
} // 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
|
||||||
|
|
||||||
|
|
||||||
///////////////////////
|
///////////////////////
|
||||||
@ -6854,7 +7184,7 @@ uint16_t mode_freqmatrix(void) { // Freqmatrix. By Andreas Plesch
|
|||||||
|
|
||||||
return FRAMETIME;
|
return FRAMETIME;
|
||||||
} // mode_freqmatrix()
|
} // 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
|
||||||
|
|
||||||
|
|
||||||
//////////////////////
|
//////////////////////
|
||||||
@ -6865,7 +7195,6 @@ static const char *_data_FX_MODE_FREQMATRIX PROGMEM = "Freqmatrix ♫@Time delay
|
|||||||
// SEGMENT.speed select faderate
|
// SEGMENT.speed select faderate
|
||||||
// SEGMENT.intensity select colour index
|
// SEGMENT.intensity select colour index
|
||||||
uint16_t mode_freqpixels(void) { // Freqpixel. By Andrew Tuline.
|
uint16_t mode_freqpixels(void) { // Freqpixel. By Andrew Tuline.
|
||||||
um_data_t *um_data;
|
|
||||||
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
||||||
// add support for no audio data
|
// add support for no audio data
|
||||||
um_data = simulateSound(SEGMENT.soundSim);
|
um_data = simulateSound(SEGMENT.soundSim);
|
||||||
@ -6891,7 +7220,7 @@ uint16_t mode_freqpixels(void) { // Freqpixel. By Andrew Tuline.
|
|||||||
|
|
||||||
return FRAMETIME;
|
return FRAMETIME;
|
||||||
} // mode_freqpixels()
|
} // 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
|
||||||
|
|
||||||
|
|
||||||
//////////////////////
|
//////////////////////
|
||||||
@ -6962,7 +7291,7 @@ uint16_t mode_freqwave(void) { // Freqwave. By Andreas Pleschun
|
|||||||
|
|
||||||
return FRAMETIME;
|
return FRAMETIME;
|
||||||
} // mode_freqwave()
|
} // 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
|
||||||
|
|
||||||
|
|
||||||
///////////////////////
|
///////////////////////
|
||||||
@ -7015,7 +7344,7 @@ uint16_t mode_gravfreq(void) { // Gravfreq. By Andrew Tuline.
|
|||||||
|
|
||||||
return FRAMETIME;
|
return FRAMETIME;
|
||||||
} // mode_gravfreq()
|
} // 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
|
||||||
|
|
||||||
|
|
||||||
//////////////////////
|
//////////////////////
|
||||||
@ -7041,7 +7370,7 @@ uint16_t mode_noisemove(void) { // Noisemove. By: Andrew Tuli
|
|||||||
|
|
||||||
return FRAMETIME;
|
return FRAMETIME;
|
||||||
} // mode_noisemove()
|
} // 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
|
||||||
|
|
||||||
|
|
||||||
//////////////////////
|
//////////////////////
|
||||||
@ -7085,7 +7414,7 @@ uint16_t mode_rocktaves(void) { // Rocktaves. Same note from eac
|
|||||||
|
|
||||||
return FRAMETIME;
|
return FRAMETIME;
|
||||||
} // mode_rocktaves()
|
} // 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
|
||||||
|
|
||||||
|
|
||||||
///////////////////////
|
///////////////////////
|
||||||
@ -7105,18 +7434,18 @@ uint16_t mode_waterfall(void) { // Waterfall. By: Andrew Tulin
|
|||||||
uint8_t samplePeak = *(uint8_t*)um_data->u_data[5];
|
uint8_t samplePeak = *(uint8_t*)um_data->u_data[5];
|
||||||
float FFT_MajorPeak = *(float*)um_data->u_data[6];
|
float FFT_MajorPeak = *(float*)um_data->u_data[6];
|
||||||
float FFT_Magnitude = *(float*)um_data->u_data[7];
|
float FFT_Magnitude = *(float*)um_data->u_data[7];
|
||||||
uint8_t *maxVol = (uint8_t*)um_data->u_data[9];
|
uint8_t maxVol = *(uint8_t*)um_data->u_data[9];
|
||||||
uint8_t *binNum = (uint8_t*)um_data->u_data[10];
|
uint8_t binNum = *(uint8_t*)um_data->u_data[10];
|
||||||
float multAgc = *(float*)um_data->u_data[11];
|
float multAgc = *(float*)um_data->u_data[11];
|
||||||
|
|
||||||
if (SEGENV.call == 0) {
|
if (SEGENV.call == 0) {
|
||||||
SEGENV.aux0 = 255;
|
SEGENV.aux0 = 255;
|
||||||
SEGMENT.custom2 = *binNum;
|
SEGMENT.custom2 = binNum;
|
||||||
SEGMENT.custom3 = *maxVol * 2;
|
SEGMENT.custom3 = maxVol * 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
*binNum = SEGMENT.custom2; // Select a bin.
|
binNum = SEGMENT.custom2; // Select a bin.
|
||||||
*maxVol = SEGMENT.custom3/2; // Our volume comparator.
|
maxVol = SEGMENT.custom3/2; // Our volume comparator.
|
||||||
|
|
||||||
uint8_t secondHand = micros() / (256-SEGMENT.speed)/500 + 1 % 16;
|
uint8_t secondHand = micros() / (256-SEGMENT.speed)/500 + 1 % 16;
|
||||||
if (SEGENV.aux0 != secondHand) { // Triggered millis timing.
|
if (SEGENV.aux0 != secondHand) { // Triggered millis timing.
|
||||||
@ -7138,7 +7467,7 @@ uint16_t mode_waterfall(void) { // Waterfall. By: Andrew Tulin
|
|||||||
|
|
||||||
return FRAMETIME;
|
return FRAMETIME;
|
||||||
} // mode_waterfall()
|
} // 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
|
#ifndef WLED_DISABLE_2D
|
||||||
@ -7195,7 +7524,7 @@ uint16_t mode_2DGEQ(void) { // By Will Tatam. Code reduction by Ewoud Wijma.
|
|||||||
|
|
||||||
return FRAMETIME;
|
return FRAMETIME;
|
||||||
} // mode_2DGEQ()
|
} // 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
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////
|
/////////////////////////
|
||||||
@ -7255,7 +7584,7 @@ uint16_t mode_2DFunkyPlank(void) { // Written by ??? Adapted by Wil
|
|||||||
SEGMENT.setPixels(leds);
|
SEGMENT.setPixels(leds);
|
||||||
return FRAMETIME;
|
return FRAMETIME;
|
||||||
} // mode_2DFunkyPlank
|
} // 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
|
#endif // WLED_DISABLE_2D
|
||||||
|
|
||||||
@ -7582,6 +7911,7 @@ void WS2812FX::setupEffectData() {
|
|||||||
addEffect(FX_MODE_2DGEQ, &mode_2DGEQ, _data_FX_MODE_2DGEQ);
|
addEffect(FX_MODE_2DGEQ, &mode_2DGEQ, _data_FX_MODE_2DGEQ);
|
||||||
addEffect(FX_MODE_WATERFALL, &mode_waterfall, _data_FX_MODE_WATERFALL);
|
addEffect(FX_MODE_WATERFALL, &mode_waterfall, _data_FX_MODE_WATERFALL);
|
||||||
addEffect(FX_MODE_FREQPIXELS, &mode_freqpixels, _data_FX_MODE_FREQPIXELS);
|
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_NOISEFIRE, &mode_noisefire, _data_FX_MODE_NOISEFIRE);
|
||||||
addEffect(FX_MODE_PUDDLEPEAK, &mode_puddlepeak, _data_FX_MODE_PUDDLEPEAK);
|
addEffect(FX_MODE_PUDDLEPEAK, &mode_puddlepeak, _data_FX_MODE_PUDDLEPEAK);
|
||||||
addEffect(FX_MODE_NOISEMOVE, &mode_noisemove, _data_FX_MODE_NOISEMOVE);
|
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
|
uint32_t vLen = vW * vH; // use all pixels from segment
|
||||||
switch (map1D2D) {
|
switch (map1D2D) {
|
||||||
case M12_VerticalBar:
|
case M12_VerticalBar:
|
||||||
vLen = vW; // segment width since it is used in getPixelColor()
|
vLen = vW;
|
||||||
break;
|
break;
|
||||||
case M12_Block:
|
|
||||||
case M12_Circle:
|
case M12_Circle:
|
||||||
vLen = max(vW,vH); // get the longest dimension
|
case M12_Block:
|
||||||
|
vLen = (vW + vH) / 2; // take half of the average width
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return vLen;
|
return vLen;
|
||||||
@ -317,7 +317,7 @@ void IRAM_ATTR Segment::setPixelColor(int i, uint32_t col)
|
|||||||
break;
|
break;
|
||||||
case M12_Circle:
|
case M12_Circle:
|
||||||
// expand in circular fashion from center
|
// expand in circular fashion from center
|
||||||
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
|
for (float degrees = 0; degrees <= 90; degrees += 90.0f / (4*i+1)) { // this may prove too many iterations on larger matrices
|
||||||
// may want to try float version as well (with or without antialiasing)
|
// may want to try float version as well (with or without antialiasing)
|
||||||
int x = roundf(sin_t(degrees*DEG_TO_RAD) * i);
|
int x = roundf(sin_t(degrees*DEG_TO_RAD) * i);
|
||||||
int y = roundf(cos_t(degrees*DEG_TO_RAD) * i);
|
int y = roundf(cos_t(degrees*DEG_TO_RAD) * i);
|
||||||
@ -405,19 +405,17 @@ uint32_t Segment::getPixelColor(uint16_t i)
|
|||||||
{
|
{
|
||||||
#ifndef WLED_DISABLE_2D
|
#ifndef WLED_DISABLE_2D
|
||||||
if (height() > 1) { // if this does not work use strip.isMatrix
|
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();
|
uint16_t vW = virtualWidth();
|
||||||
switch (map1D2D) {
|
switch (map1D2D) {
|
||||||
case M12_Pixels:
|
case M12_Pixels:
|
||||||
return getPixelColorXY(i % vW, i / vW);
|
return getPixelColorXY(i % vW, i / vW);
|
||||||
break;
|
break;
|
||||||
case M12_VerticalBar:
|
case M12_VerticalBar:
|
||||||
return getPixelColorXY(i, 0);
|
|
||||||
break;
|
|
||||||
case M12_Circle:
|
case M12_Circle:
|
||||||
case M12_Block:
|
case M12_Block:
|
||||||
// use longest dimension
|
// only use 1st row
|
||||||
return vW>vH ? getPixelColorXY(i, 0) : getPixelColorXY(0, i);
|
return getPixelColorXY(i, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -233,6 +233,14 @@ button {
|
|||||||
border: 0px;
|
border: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#liveview2D {
|
||||||
|
height: 320px;
|
||||||
|
display: none;
|
||||||
|
width: 100%;
|
||||||
|
border: 0px;
|
||||||
|
margin: auto;
|
||||||
|
}
|
||||||
|
|
||||||
.tab {
|
.tab {
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
color: var(--c-d);
|
color: var(--c-d);
|
||||||
@ -827,13 +835,13 @@ input[type=range]::-moz-range-thumb {
|
|||||||
}
|
}
|
||||||
|
|
||||||
select {
|
select {
|
||||||
padding: 4px 8px;
|
padding: 4px 0 4px 8px;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-size: 19px;
|
font-size: 19px;
|
||||||
background-color: var(--c-3);
|
background-color: var(--c-3);
|
||||||
color: var(--c-d);
|
color: var(--c-d);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
border: 0 solid var(--c-2);
|
border: 1px solid var(--c-2);
|
||||||
border-radius: 20px;
|
border-radius: 20px;
|
||||||
transition-duration: 0.5s;
|
transition-duration: 0.5s;
|
||||||
-webkit-backface-visibility: hidden;
|
-webkit-backface-visibility: hidden;
|
||||||
@ -842,7 +850,6 @@ select {
|
|||||||
-moz-appearance: none;
|
-moz-appearance: none;
|
||||||
backface-visibility: hidden;
|
backface-visibility: hidden;
|
||||||
transform:translate3d(0,0,0);
|
transform:translate3d(0,0,0);
|
||||||
text-overflow: ellipsis;
|
|
||||||
}
|
}
|
||||||
#tt {
|
#tt {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
@ -329,6 +329,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="mliveview2D" class="modal">
|
||||||
|
<div id="kliveview2D">Loading...</div><br>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div id="rover" class="modal">
|
<div id="rover" class="modal">
|
||||||
<i class="icons huge"></i><br>
|
<i class="icons huge"></i><br>
|
||||||
<div id="lv">?</div><br><br>
|
<div id="lv">?</div><br><br>
|
||||||
|
@ -605,7 +605,7 @@ function parseInfo(i) {
|
|||||||
mh = i.leds.matrix ? i.leds.matrix.h : 0;
|
mh = i.leds.matrix ? i.leds.matrix.h : 0;
|
||||||
isM = mw>0 && mh>0;
|
isM = mw>0 && mh>0;
|
||||||
if (!isM) hideModes("2D ");
|
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
|
//https://stackoverflow.com/questions/2592092/executing-script-elements-inserted-with-innerhtml
|
||||||
@ -707,10 +707,11 @@ function populateSegments(s)
|
|||||||
</div>`;
|
</div>`;
|
||||||
let sndSim = `<div data-snd="ssim" class="lbl-s hide">Sound sim<br>
|
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})">
|
<div class="sel-p"><select class="sel-p" id="seg${i}ssim" onchange="setSSim(${i})">
|
||||||
<option value="0" ${inst.ssim==0?' selected':''}>BeatSin</option>
|
<option value="0" ${inst.ssim==0?' selected':''}>Off</option>
|
||||||
<option value="1" ${inst.ssim==1?' selected':''}>WeWillRockYou</option>
|
<option value="1" ${inst.ssim==1?' selected':''}>BeatSin</option>
|
||||||
<option value="2" ${inst.ssim==2?' selected':''}>U10_3</option>
|
<option value="2" ${inst.ssim==2?' selected':''}>WeWillRockYou</option>
|
||||||
<option value="3" ${inst.ssim==3?' selected':''}>U14_3</option>
|
<option value="3" ${inst.ssim==3?' selected':''}>U10_3</option>
|
||||||
|
<option value="4" ${inst.ssim==4?' selected':''}>U14_3</option>
|
||||||
</select></div>
|
</select></div>
|
||||||
</div>`;
|
</div>`;
|
||||||
cn += `<div class="seg lstI ${i==s.mainseg ? 'selected' : ''} ${exp ? "expanded":""}" id="seg${i}">
|
cn += `<div class="seg lstI ${i==s.mainseg ? 'selected' : ''} ${exp ? "expanded":""}" id="seg${i}">
|
||||||
@ -1525,10 +1526,30 @@ function toggleSync()
|
|||||||
|
|
||||||
function toggleLiveview()
|
function toggleLiveview()
|
||||||
{
|
{
|
||||||
|
if (isInfo) toggleInfo();
|
||||||
|
if (isNodes) toggleNodes();
|
||||||
|
|
||||||
isLv = !isLv;
|
isLv = !isLv;
|
||||||
gId('liveview').style.display = (isLv) ? "block":"none";
|
|
||||||
var url = (loc?`http://${locip}`:'') + "/liveview";
|
var lvID = "liveview";
|
||||||
gId('liveview').src = (isLv) ? url:"about:blank";
|
if (isM) {
|
||||||
|
lvID = "liveview2D"
|
||||||
|
if (isLv) {
|
||||||
|
var cn = '<iframe id="liveview2D" src="about:blank"></iframe>';
|
||||||
|
d.getElementById('kliveview2D').innerHTML = cn;
|
||||||
|
}
|
||||||
|
|
||||||
|
gId('mliveview2D').style.transform = (isLv) ? "translateY(0px)":"translateY(100%)";
|
||||||
|
gId('buttonSr').lastChild.innerHTML = "Peek2D"; //lastchild is <p>Peek</p>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gId('buttonSr').lastChild.innerHTML = "Peek"; //lastchild is <p>Peek</p>
|
||||||
|
}
|
||||||
|
|
||||||
|
gId(lvID).style.display = (isLv) ? "block":"none";
|
||||||
|
var url = (loc?`http://${locip}`:'') + "/" + lvID;
|
||||||
|
gId(lvID).src = (isLv) ? url:"about:blank";
|
||||||
gId('buttonSr').className = (isLv) ? "active":"";
|
gId('buttonSr').className = (isLv) ? "active":"";
|
||||||
if (!isLv && ws && ws.readyState === WebSocket.OPEN) ws.send('{"lv":false}');
|
if (!isLv && ws && ws.readyState === WebSocket.OPEN) ws.send('{"lv":false}');
|
||||||
size();
|
size();
|
||||||
@ -1537,6 +1558,7 @@ function toggleLiveview()
|
|||||||
function toggleInfo()
|
function toggleInfo()
|
||||||
{
|
{
|
||||||
if (isNodes) toggleNodes();
|
if (isNodes) toggleNodes();
|
||||||
|
if (isLv) toggleLiveview();
|
||||||
isInfo = !isInfo;
|
isInfo = !isInfo;
|
||||||
if (isInfo) requestJson();
|
if (isInfo) requestJson();
|
||||||
gId('info').style.transform = (isInfo) ? "translateY(0px)":"translateY(100%)";
|
gId('info').style.transform = (isInfo) ? "translateY(0px)":"translateY(100%)";
|
||||||
@ -1546,6 +1568,7 @@ function toggleInfo()
|
|||||||
function toggleNodes()
|
function toggleNodes()
|
||||||
{
|
{
|
||||||
if (isInfo) toggleInfo();
|
if (isInfo) toggleInfo();
|
||||||
|
if (isLv) toggleLiveview();
|
||||||
isNodes = !isNodes;
|
isNodes = !isNodes;
|
||||||
if (isNodes) loadNodes();
|
if (isNodes) loadNodes();
|
||||||
gId('nodes').style.transform = (isNodes) ? "translateY(0px)":"translateY(100%)";
|
gId('nodes').style.transform = (isNodes) ? "translateY(0px)":"translateY(100%)";
|
||||||
|
119
wled00/data/liveviewws2D.htm
Normal file
119
wled00/data/liveviewws2D.htm
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="theme-color" content="#222222">
|
||||||
|
<title>WLED Live Preview</title>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
#canv1, #canv2 {
|
||||||
|
background: black;
|
||||||
|
filter: brightness(175%);
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div style="margin:auto">
|
||||||
|
<canvas id="liveviewCanvas" width="320", height="320" style="border:1px solid #000">
|
||||||
|
LiveView
|
||||||
|
</canvas>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
var canvas = document.getElementById('liveviewCanvas');
|
||||||
|
var leds = "";
|
||||||
|
var matrixWidth = 0;
|
||||||
|
var pixelsPerLed = 0;
|
||||||
|
// Check for canvas support
|
||||||
|
if (canvas.getContext) {
|
||||||
|
// Access the rendering context
|
||||||
|
var ctx = canvas.getContext('2d');
|
||||||
|
|
||||||
|
//In case of pixels
|
||||||
|
|
||||||
|
// // ImageData object
|
||||||
|
// var imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
|
||||||
|
// // One-dimensional array containing the data in the RGBA order
|
||||||
|
// var data = imageData.data;
|
||||||
|
|
||||||
|
// function drawLedPixels(x, y, r, g, b, a) { //old
|
||||||
|
// // console.log(x, y, r, g, b, a);
|
||||||
|
// for (right = 0; right < pixelsPerLed; right++) {
|
||||||
|
// for (down = 0; down < pixelsPerLed; down++) {
|
||||||
|
// ff = (x * pixelsPerLed + right + (y * pixelsPerLed + down) * matrixWidth * pixelsPerLed) * 4;
|
||||||
|
// // if (x==15 && y==15)
|
||||||
|
// // console.log("ff=" + x + " * " + pixelsPerLed + " +" + right + " + (" + y + " * " + pixelsPerLed + " +" + down + ") * " + matrixWidth + ") * 4 = " + ff, data.length); //(5*10+1 + (12*10+1) * 16) * 4 = (51 + 121*16) * 4
|
||||||
|
// data[ff + 0] = r;
|
||||||
|
// data[ff + 1] = g;
|
||||||
|
// data[ff + 2] = b;
|
||||||
|
// data[ff + 3] = a;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
function drawLedCircles(x, y, r, g, b, a) {
|
||||||
|
ctx.fillStyle = `rgb(${r},${g},${b})`;
|
||||||
|
ctx.beginPath();
|
||||||
|
ctx.arc(x*pixelsPerLed+pixelsPerLed/2, y*pixelsPerLed+pixelsPerLed/2, pixelsPerLed/2, 0, 2 * Math.PI);
|
||||||
|
ctx.fill();
|
||||||
|
}
|
||||||
|
|
||||||
|
function paintLeds() {
|
||||||
|
// data represents the Uint8ClampedArray containing the data
|
||||||
|
// in the RGBA order [r0, g0, b0, a0, r1, g1, b1, a1, ..., rn, gn, bn, an]
|
||||||
|
|
||||||
|
for (i = 2; i < leds.length; i+=3) {
|
||||||
|
let ff = (i-2)/3;
|
||||||
|
drawLedCircles(ff%matrixWidth, Math.floor(ff/matrixWidth), leds[i], leds[i+1], leds[i+2], 255)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ctx.putImageData(imageData, 0, 0); //in case of drawLedPixels
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function updatePreview(ledsp) {
|
||||||
|
leds = ledsp;
|
||||||
|
matrixWidth = Math.sqrt((leds.length - 2)/3);
|
||||||
|
pixelsPerLed = canvas.width / matrixWidth;
|
||||||
|
// console.log(Math.sqrt((leds.length - 2)/3), pixelsPerLed, leds);
|
||||||
|
paintLeds();
|
||||||
|
}
|
||||||
|
|
||||||
|
function getLiveJson(e) {
|
||||||
|
try {
|
||||||
|
if (toString.call(e.data) === '[object ArrayBuffer]') {
|
||||||
|
let leds = new Uint8Array(event.data);
|
||||||
|
if (leds[0] != 76) return; //'L'
|
||||||
|
updatePreview(leds);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
console.error("Peek WS error:",err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var ws;
|
||||||
|
try {
|
||||||
|
ws = top.window.ws;
|
||||||
|
} catch (e) {}
|
||||||
|
if (ws && ws.readyState === WebSocket.OPEN) {
|
||||||
|
console.info("Peek uses top WS");
|
||||||
|
ws.send("{'lv':true}");
|
||||||
|
} else {
|
||||||
|
console.info("Peek WS opening");
|
||||||
|
ws = new WebSocket((window.location.protocol == "https:"?"wss":"ws")+"://"+document.location.host+"/ws");
|
||||||
|
ws.onopen = function () {
|
||||||
|
console.info("Peek WS open");
|
||||||
|
ws.send("{'lv':true}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ws.binaryType = "arraybuffer";
|
||||||
|
ws.addEventListener('message',getLiveJson);
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -327,7 +327,6 @@ 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);
|
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);
|
int16_t extractModeDefaults(uint8_t mode, const char *segVar);
|
||||||
uint16_t crc16(const unsigned char* data_p, size_t length);
|
uint16_t crc16(const unsigned char* data_p, size_t length);
|
||||||
um_data_t* simulateSound(uint8_t simulationId);
|
|
||||||
|
|
||||||
//wled_eeprom.cpp
|
//wled_eeprom.cpp
|
||||||
void applyMacro(byte index);
|
void applyMacro(byte index);
|
||||||
|
@ -281,6 +281,72 @@ 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!!
|
// Autogenerated from wled00/data/404.htm, do not edit!!
|
||||||
const uint16_t PAGE_404_length = 868;
|
const uint16_t PAGE_404_length = 868;
|
||||||
const uint8_t PAGE_404[] PROGMEM = {
|
const uint8_t PAGE_404[] PROGMEM = {
|
||||||
|
3596
wled00/html_ui.h
3596
wled00/html_ui.h
File diff suppressed because it is too large
Load Diff
@ -172,22 +172,14 @@ void deserializeSegment(JsonObject elem, byte it, byte presetId)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
byte fx = seg.mode;
|
byte fx = seg.mode;
|
||||||
if (getVal(elem["fx"], &fx, 0, strip.getModeCount())) { //load effect ('r' random, '~' inc/dec, 0-255 exact value)
|
if (getVal(elem["fx"], &fx, 1, strip.getModeCount())) { //load effect ('r' random, '~' inc/dec, 1-255 exact value)
|
||||||
if (!presetId && currentPlaylist>=0) unloadPlaylist();
|
if (!presetId && currentPlaylist>=0) unloadPlaylist();
|
||||||
if (fx != seg.mode) {
|
strip.setMode(id, fx);
|
||||||
//seg.startTransition(strip.getTransition()); // set effect transitions
|
}
|
||||||
seg.markForReset();
|
|
||||||
seg.mode = fx;
|
|
||||||
// load default values from effect string if effect is selected without
|
// load default values from effect string if effect is selected without
|
||||||
// any other effect parameter (i.e. effect clicked in UI)
|
// any other effect parameter (i.e. effect clicked in UI)
|
||||||
if ( 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("ix")].isNull()
|
|
||||||
&& elem["pal"].isNull()
|
|
||||||
&& elem[F("c1")].isNull()
|
|
||||||
&& elem[F("c2")].isNull()
|
|
||||||
&& elem[F("c3")].isNull() )
|
|
||||||
{
|
|
||||||
// compatibility mode begin
|
|
||||||
char buf[5]; // dummy buffer
|
char buf[5]; // dummy buffer
|
||||||
for (int i=0; i<5; i++) {
|
for (int i=0; i<5; i++) {
|
||||||
uint8_t *var;
|
uint8_t *var;
|
||||||
@ -201,22 +193,19 @@ void deserializeSegment(JsonObject elem, byte it, byte presetId)
|
|||||||
extractModeSlider(fx, i, buf, 4, var);
|
extractModeSlider(fx, i, buf, 4, var);
|
||||||
}
|
}
|
||||||
extractModeSlider(fx, 255, buf, 4, &seg.palette);
|
extractModeSlider(fx, 255, buf, 4, &seg.palette);
|
||||||
//end compatibility mode
|
|
||||||
int16_t sOpt;
|
int16_t sOpt;
|
||||||
sOpt = extractModeDefaults(fx, SET_F("sx")); if (sOpt >= 0) seg.speed = sOpt;
|
sOpt = extractModeDefaults(fx, SET_F("sx")); if (sOpt >= 0) seg.speed = sOpt;
|
||||||
sOpt = extractModeDefaults(fx, SET_F("ix")); if (sOpt >= 0) seg.intensity = sOpt;
|
sOpt = extractModeDefaults(fx, SET_F("ix")); if (sOpt >= 0) seg.intensity = sOpt;
|
||||||
sOpt = extractModeDefaults(fx, SET_F("c1")); if (sOpt >= 0) seg.custom1 = sOpt;
|
sOpt = extractModeDefaults(fx, SET_F("c1")); if (sOpt >= 0) seg.custom1 = sOpt;
|
||||||
sOpt = extractModeDefaults(fx, SET_F("c2")); if (sOpt >= 0) seg.custom2 = sOpt;
|
sOpt = extractModeDefaults(fx, SET_F("c2")); if (sOpt >= 0) seg.custom2 = sOpt;
|
||||||
sOpt = extractModeDefaults(fx, SET_F("c3")); if (sOpt >= 0) seg.custom3 = sOpt;
|
sOpt = extractModeDefaults(fx, SET_F("c3")); if (sOpt >= 0) seg.custom3 = sOpt;
|
||||||
sOpt = extractModeDefaults(fx, "pal"); if (sOpt >= 0 && sOpt < strip.getPaletteCount()) seg.palette = sOpt;
|
sOpt = extractModeDefaults(fx, "pal"); if (sOpt >= 0) seg.palette = sOpt;
|
||||||
sOpt = extractModeDefaults(fx, SET_F("mp12")); if (sOpt >= 0) seg.map1D2D = sOpt & 0x03;
|
sOpt = extractModeDefaults(fx, SET_F("mp12")); if (sOpt >= 0) seg.map1D2D = sOpt & 0x03;
|
||||||
sOpt = extractModeDefaults(fx, SET_F("ssim")); if (sOpt >= 0) seg.soundSim = sOpt & 0x07;
|
sOpt = extractModeDefaults(fx, SET_F("ssim")); if (sOpt >= 0) seg.soundSim = sOpt & 0x07;
|
||||||
sOpt = extractModeDefaults(fx, "rev"); if (sOpt >= 0) seg.reverse = (bool)sOpt; // setOption(SEG_OPTION_REVERSED, (bool)sOpt); // NOTE: setting this option is a risky business
|
sOpt = extractModeDefaults(fx, "rev"); if (sOpt >= 0) seg.setOption(SEG_OPTION_REVERSED, (bool)sOpt);
|
||||||
sOpt = extractModeDefaults(fx, SET_F("mi")); if (sOpt >= 0) seg.mirror = (bool)sOpt; // setOption(SEG_OPTION_MIRROR, (bool)sOpt); // NOTE: setting this option is a risky business
|
sOpt = extractModeDefaults(fx, SET_F("mi")); if (sOpt >= 0) seg.setOption(SEG_OPTION_MIRROR, (bool)sOpt);
|
||||||
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("rY")); if (sOpt >= 0) seg.setOption(SEG_OPTION_REVERSED_Y, (bool)sOpt);
|
||||||
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
|
sOpt = extractModeDefaults(fx, SET_F("mY")); if (sOpt >= 0) seg.setOption(SEG_OPTION_MIRROR_Y, (bool)sOpt);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//getVal also supports inc/decrementing and random
|
//getVal also supports inc/decrementing and random
|
||||||
|
151
wled00/util.cpp
151
wled00/util.cpp
@ -381,154 +381,3 @@ uint16_t crc16(const unsigned char* data_p, size_t length) {
|
|||||||
}
|
}
|
||||||
return crc;
|
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)
|
// version code in format yymmddb (b = daily build)
|
||||||
#define VERSION 2207251
|
#define VERSION 2207241
|
||||||
|
|
||||||
//uncomment this if you have a "my_config.h" file you'd like to use
|
//uncomment this if you have a "my_config.h" file you'd like to use
|
||||||
//#define WLED_USE_MY_CONFIG
|
//#define WLED_USE_MY_CONFIG
|
||||||
|
@ -103,6 +103,14 @@ void initServer()
|
|||||||
request->send(response);
|
request->send(response);
|
||||||
//request->send_P(200, "text/html", PAGE_liveviewws);
|
//request->send_P(200, "text/html", PAGE_liveviewws);
|
||||||
});
|
});
|
||||||
|
server.on("/liveview2D", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||||
|
if (handleIfNoneMatchCacheHeader(request)) return;
|
||||||
|
AsyncWebServerResponse *response = request->beginResponse_P(200, "text/html", PAGE_liveviewws2D, PAGE_liveviewws2D_length);
|
||||||
|
response->addHeader(FPSTR(s_content_enc),"gzip");
|
||||||
|
setStaticContentCacheHeaders(response);
|
||||||
|
request->send(response);
|
||||||
|
//request->send_P(200, "text/html", PAGE_liveviewws);
|
||||||
|
});
|
||||||
#else
|
#else
|
||||||
server.on("/liveview", HTTP_GET, [](AsyncWebServerRequest *request){
|
server.on("/liveview", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||||
if (handleIfNoneMatchCacheHeader(request)) return;
|
if (handleIfNoneMatchCacheHeader(request)) return;
|
||||||
|
Loading…
Reference in New Issue
Block a user