diff --git a/main/main.ino b/main/main.ino index d3a207a..222dcaf 100755 --- a/main/main.ino +++ b/main/main.ino @@ -170,9 +170,10 @@ Pattern mainPatterns[]{ {33, "Classical", true, classical}, {34, "Basic Bands", true, basic_bands}, {35, "Advanced Bands", true, advanced_bands}, - {36, "Formant Band", true, formant_band} + {36, "Formant Band", true, formant_band}, + {37, "Mirrored Pixel Frequency", true, mirror_pix_freq} }; -int NUM_PATTERNS = 37; // MAKE SURE TO UPDATE THIS WITH THE ACTUAL NUMBER OF PATTERNS +int NUM_PATTERNS = 38; // MAKE SURE TO UPDATE THIS WITH THE ACTUAL NUMBER OF PATTERNS (+1 last array pos) SimplePatternList gPatterns_layer = {blank, spring_mass_1}; diff --git a/main/patterns.cpp b/main/patterns.cpp index 551679a..c6f6741 100755 --- a/main/patterns.cpp +++ b/main/patterns.cpp @@ -281,6 +281,32 @@ void pix_freq() { leds[current_history.pix_pos] = current_history.pix_pos < virtual_led_count ? CHSV(current_history.tempHue, 255, 255):CRGB(0, 0, 0); } +// A mirroed version of the pix_freq, splittion it on two sides starting from the middle +void mirror_pix_freq() { + fadeToBlackBy(leds, virtual_led_count, 50); + + if (volume > 125) { + current_history.pix_pos = (virtual_led_count / 2) + map(peak, MIN_FREQUENCY, MAX_FREQUENCY, -virtual_led_count/2 , virtual_led_count / 2); + current_history.tempHue = fHue; + + } else { + current_history.pix_pos--; + current_history.vol_pos--; + } + if (vol_show) { + if (volume > 75) { + current_history.vol_pos = (virtual_led_count / 2) + map(volume, MIN_VOLUME, MAX_VOLUME, virtual_led_count/2 , virtual_led_count / 2); + current_history.tempHue = fHue; + } else { + current_history.vol_pos--; + } + leds[virtual_led_count / 2 - 1 - current_history.vol_pos] = current_history.vol_pos < virtual_led_count/2 ? CRGB(255, 255, 255):CRGB(0, 0, 0); + leds[virtual_led_count / 2 + 1 + current_history.vol_pos] = current_history.vol_pos < virtual_led_count/2 ? CRGB(255, 255, 255):CRGB(0, 0, 0); + } + leds[virtual_led_count/2 - 1 - current_history.pix_pos] = current_history.pix_pos < virtual_led_count/2 ? CHSV(current_history.tempHue, 255, 255):CRGB(0, 0, 0); + leds[virtual_led_count/2 + 1 + current_history.pix_pos] = current_history.pix_pos < virtual_led_count/2 ? CHSV(current_history.tempHue, 255, 255):CRGB(0, 0, 0); +} + // Utility function for sending a wave with sine for the math rock function void send_wave() { double change_by = vbrightness; diff --git a/main/patterns.h b/main/patterns.h index 5b51a60..b428ca1 100755 --- a/main/patterns.h +++ b/main/patterns.h @@ -51,6 +51,8 @@ void classical(); void pix_freq(); +void mirror_pix_freq(); + void send_wave(); void math();