Skip to content

Commit 47363f0

Browse files
committed
Added mirror_pix_freq pattern
Updated pattern array, added function in patterns.c and patterns.h
1 parent 784cfcb commit 47363f0

File tree

3 files changed

+31
-2
lines changed

3 files changed

+31
-2
lines changed

main/main.ino

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,10 @@ Pattern mainPatterns[]{
170170
{33, "Classical", true, classical},
171171
{34, "Basic Bands", true, basic_bands},
172172
{35, "Advanced Bands", true, advanced_bands},
173-
{36, "Formant Band", true, formant_band}
173+
{36, "Formant Band", true, formant_band},
174+
{37, "Mirrored Pixel Frequency", true, mirror_pix_freq}
174175
};
175-
int NUM_PATTERNS = 37; // MAKE SURE TO UPDATE THIS WITH THE ACTUAL NUMBER OF PATTERNS
176+
int NUM_PATTERNS = 38; // MAKE SURE TO UPDATE THIS WITH THE ACTUAL NUMBER OF PATTERNS (+1 last array pos)
176177

177178
SimplePatternList gPatterns_layer = {blank, spring_mass_1};
178179

main/patterns.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,32 @@ void pix_freq() {
281281
leds[current_history.pix_pos] = current_history.pix_pos < virtual_led_count ? CHSV(current_history.tempHue, 255, 255):CRGB(0, 0, 0);
282282
}
283283

284+
// A mirroed version of the pix_freq, splittion it on two sides starting from the middle
285+
void mirror_pix_freq() {
286+
fadeToBlackBy(leds, virtual_led_count, 50);
287+
288+
if (volume > 125) {
289+
current_history.pix_pos = (virtual_led_count / 2) + map(peak, MIN_FREQUENCY, MAX_FREQUENCY, -virtual_led_count/2 , virtual_led_count / 2);
290+
current_history.tempHue = fHue;
291+
292+
} else {
293+
current_history.pix_pos--;
294+
current_history.vol_pos--;
295+
}
296+
if (vol_show) {
297+
if (volume > 75) {
298+
current_history.vol_pos = (virtual_led_count / 2) + map(volume, MIN_VOLUME, MAX_VOLUME, virtual_led_count/2 , virtual_led_count / 2);
299+
current_history.tempHue = fHue;
300+
} else {
301+
current_history.vol_pos--;
302+
}
303+
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);
304+
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);
305+
}
306+
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);
307+
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);
308+
}
309+
284310
// Utility function for sending a wave with sine for the math rock function
285311
void send_wave() {
286312
double change_by = vbrightness;

main/patterns.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ void classical();
5151

5252
void pix_freq();
5353

54+
void mirror_pix_freq();
55+
5456
void send_wave();
5557

5658
void math();

0 commit comments

Comments
 (0)