NanoLux (Device) 3.0
Codebase for the open-source AudioLux device.
Loading...
Searching...
No Matches
globals.h
Go to the documentation of this file.
1
14#ifndef GLOBALS_H
15#define GLOBALS_H
16
17#include "nanolux_types.h"
18
20double formants[3]; // Master formants array that constantly changes;
21bool noise; // Master Noisiness versus Periodic flag that is TRUE when noisy, FALSE when periodic;
22bool drums[3]; // Master drums array that stores whether a KICK, SNARE, or CYMBAL is happening in each element of the array;
23double fbs[5]; // Master FIVE BAND SPLIT which stores changing bands based on raw frequencies
24double fss[5]; // Master FIVE SAMPLE SPLIT which stores changing bands based on splitting up the samples
25int advanced_size = 20;
26unsigned int sampling_period_us = round(1000000 / SAMPLING_FREQUENCY);
27int F0arr[20];
28int F1arr[20];
29int F2arr[20];
30unsigned long microseconds;
31double vReal[SAMPLES]; // Sampling buffers
32double vImag[SAMPLES];
33double vRealHist[SAMPLES]; // Delta freq
34double delt[SAMPLES];
35double maxDelt = 0.; // Frequency with the biggest change in amp.
36unsigned long myTime; // For nvp
37
38//
39// Patterns structure.
40//
41// Describes a pattern by name, whether it will be presented to the user in the
42// web application and the function that implements the pattern.
43//
44typedef struct {
45 int index;
46 const char *pattern_name;
47 bool enabled;
48 void (*pattern_handler)(Strip_Buffer * buf, int len, Pattern_Data* params);
49} Pattern;
50
51//
52// Register all the patterns here. The index property must be sequential, but the code make sure
53// that constraint is satisfied. The name is arbitrary, but keep it relatively short as it will be
54// presented in a UI to the user. The enabled flag indicates whether the pattern will be shown
55// in the UI or not. If not shown, it i snot selectable. If a pattern is not registered here,
56// It will not be selectable and the loop below will not know about it.
57//
59 { 0, "None", true, blank},
60 { 1, "Pixel Frequency", true, pix_freq},
61 { 2, "Confetti", true, confetti},
62 { 3, "Hue Trail", true, hue_trail},
63 { 4, "Saturated", true, saturated},
64 { 5, "Groovy", true, groovy},
65 { 6, "Talking", true, talking},
66 { 7, "Glitch", true, glitch},
67 { 8, "Bands", true, bands},
68 { 9, "Equalizer", true, eq},
69 { 10, "Tug of War", true, tug_of_war},
70 { 11, "Rain Drop", true, random_raindrop},
71 { 12, "Fire 2012", true, Fire2012},
72 { 13, "Bar Fill", true, bar_fill},
73 { 14, "Vowel Rain Drop", true, vowels_raindrop},
74};
75int NUM_PATTERNS = 15; // MAKE SURE TO UPDATE THIS WITH THE ACTUAL NUMBER OF PATTERNS (+1 last array pos)
76
77#endif
int F1arr[20]
Used for smoothing (old) formant processing.
Definition globals.h:28
unsigned int sampling_period_us
Audio sampling period.
Definition globals.h:26
int F2arr[20]
Used for smoothing (old) formant processing.
Definition globals.h:29
double vReal[SAMPLES]
Definition globals.h:31
double fbs[5]
Definition globals.h:23
double maxDelt
Definition globals.h:35
int NUM_PATTERNS
The number of patterns that can be shown, externed from globals.h.
Definition globals.h:75
Pattern mainPatterns[]
The current list of patterns, externed from globals.h.
Definition globals.h:58
double delt[SAMPLES]
Definition globals.h:34
double vImag[SAMPLES]
Imaginary component of vReal. Unused.
Definition globals.h:32
double vRealHist[SAMPLES]
Last state of the vReal array.
Definition globals.h:33
int formant_pose
Used for smoothing (old) formant processing.
Definition globals.h:19
int F0arr[20]
Used for smoothing (old) formant processing.
Definition globals.h:27
double formants[3]
Global formant array, used for accessing.
Definition globals.h:20
void pix_freq(Strip_Buffer *buf, int len, Pattern_Data *params)
Based on a sufficient volume, a pixel will float to some position on the light strip and fall down (v...
Definition patterns.cpp:101
void bar_fill(Strip_Buffer *buf, int len, Pattern_Data *params)
Displays a pattern that occupies "lower" pixels at lower values, and "higher" pixels at higher values...
Definition patterns.cpp:792
void tug_of_war(Strip_Buffer *buf, int len, Pattern_Data *params)
Strip is split into two sides, red and blue showing push and pull motion based on either frequency or...
Definition patterns.cpp:657
void bands(Strip_Buffer *buf, int len, Pattern_Data *params)
Basic band config : Uses the band_split_bounce() function to generate a five band split,...
Definition patterns.cpp:411
void confetti(Strip_Buffer *buf, int len, Pattern_Data *params)
Confetti effect using frequency and brightness. Colored speckles that blink and fade smoothly are sca...
Definition patterns.cpp:134
void talking(Strip_Buffer *buf, int len, Pattern_Data *params)
Generates three clusters of lights, one in the middle, and two symmetric ones that travel out from th...
Definition patterns.cpp:285
void hue_trail(Strip_Buffer *buf, int len, Pattern_Data *params)
Outputs a steady moving stream of lights where each pixel correlates to a previous fHue value....
Definition patterns.cpp:152
void groovy(Strip_Buffer *buf, int len, Pattern_Data *params)
A cool fluctuating pattern that changes color in waves of greens, yellows, purples and blue....
Definition patterns.cpp:242
void random_raindrop(Strip_Buffer *buf, int len, Pattern_Data *params)
A random spot is chosen along the length and does a ripple based on frequency.
Definition patterns.cpp:638
void glitch(Strip_Buffer *buf, int len, Pattern_Data *params)
Creates two light clusters that move according to sine wave motion, but their speed is affected by th...
Definition patterns.cpp:341
void Fire2012(Strip_Buffer *buf, int len, Pattern_Data *params)
Fire2012 pattern utilizing heating and cooling.
Definition patterns.cpp:700
void eq(Strip_Buffer *buf, int len, Pattern_Data *params)
Short and sweet function. Each pixel corresponds to a value from vReal, where the volume at each pitc...
Definition patterns.cpp:623
void saturated(Strip_Buffer *buf, int len, Pattern_Data *params)
Fills the light strip with a nice ambient mess of colors that shift slowly over time....
Definition patterns.cpp:197
Definition storage.h:41
Definition globals.h:44
Holds persistent data for currently-running patterns.
Definition patterns.h:28