Skip to content

Commit a1e1979

Browse files
committed
Updated file headers.
1 parent 82194ba commit a1e1979

File tree

10 files changed

+169
-83
lines changed

10 files changed

+169
-83
lines changed

AudioLogic.h

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,19 @@
11
/*
22
* Torch: https://github.com/evilgeniuslabs/torch
3-
* Copyright (c) 2015 Jason Coon
3+
* Copyright (C) 2015 Jason Coon
44
*
5-
* Permission is hereby granted, free of charge, to any person obtaining a copy of
6-
* this software and associated documentation files (the "Software"), to deal in
7-
* the Software without restriction, including without limitation the rights to
8-
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9-
* the Software, and to permit persons to whom the Software is furnished to do so,
10-
* subject to the following conditions:
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU General Public License as published by
7+
* the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
119
*
12-
* The above copyright notice and this permission notice shall be included in all
13-
* copies or substantial portions of the Software.
14-
*
15-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17-
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18-
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19-
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20-
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
2114
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
2217
*/
2318

2419
#define MSGEQ7_STROBE_PIN 2
@@ -37,9 +32,8 @@ int peaksRight[bandCount];
3732
static const uint8_t peakDecay = (1024 / MATRIX_HEIGHT) / 4;
3833
bool drawPeaks = true;
3934

40-
int noiseCorrection[bandCount * 2] = {
41-
-40, -40, -40, -40, -40, -40, -40,
42-
-40, -40, -40, -40, -40, -40, -40,
35+
int noiseCorrection[bandCount] = {
36+
-55, -50, -45, -55, -40, -55, -50,
4337
};
4438

4539
uint8_t bandOffset = 3;
@@ -68,24 +62,24 @@ void readAudio() {
6862

6963
for (uint8_t band = 0; band < bandCount; band++) {
7064
digitalWrite(MSGEQ7_STROBE_PIN, LOW);
71-
delayMicroseconds(20);
65+
delayMicroseconds(30);
7266

7367
levelLeft = analogRead(MSGEQ7_LEFT_PIN);
7468
levelRight = analogRead(MSGEQ7_RIGHT_PIN);
7569
digitalWrite(MSGEQ7_STROBE_PIN, HIGH);
7670

7771
levelLeft += noiseCorrection[band];
78-
levelRight += noiseCorrection[band + bandCount];
72+
levelRight += noiseCorrection[band];
7973

8074
if(levelLeft < 0) levelLeft = 0;
81-
if(levelLeft > 1024) levelLeft = 1024;
82-
75+
if(levelLeft > 1023) levelLeft = 1023;
76+
8377
if(levelRight < 0) levelRight = 0;
84-
if(levelRight > 1024) levelRight = 1024;
85-
78+
if(levelRight > 1023) levelRight = 1023;
79+
8680
levelsLeft[band] = levelLeft;
8781
levelsRight[band] = levelRight;
88-
82+
8983
if (levelLeft >= peaksLeft[band]) {
9084
peaksLeft[band] = levelLeft;
9185
}
@@ -103,4 +97,3 @@ void readAudio() {
10397
}
10498
}
10599
}
106-

AudioPatterns.h

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* You should have received a copy of the GNU General Public License
1616
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1717
*/
18-
18+
1919
uint16_t analyzerColumns() {
2020
fill_solid(leds, NUM_LEDS, CRGB::Black);
2121

@@ -28,41 +28,41 @@ uint16_t analyzerColumns() {
2828
levelRight = peaksRight[bandIndex];
2929
}
3030

31-
CRGB colorLeft = ColorFromPalette(palette, levelLeft / levelsPerHue);
32-
CRGB colorRight = ColorFromPalette(palette, levelRight / levelsPerHue);
31+
CRGB colorLeft = ColorFromPalette(palette, levelLeft / levelsPerHue); // CRGB colorLeft = ColorFromPalette(palette, bandIndex * (256 / bandCount));
32+
// CRGB colorRight = ColorFromPalette(palette, levelRight / levelsPerHue);
3333

3434
uint8_t x = bandIndex + bandOffset;
3535
if (x >= MATRIX_WIDTH)
3636
x -= MATRIX_WIDTH;
3737

3838
drawFastVLine(x, (MATRIX_HEIGHT - 1) - levelLeft / levelsPerVerticalPixel, MATRIX_HEIGHT - 1, colorLeft);
39-
drawFastVLine(x + bandCount, (MATRIX_HEIGHT - 1) - levelRight / levelsPerVerticalPixel, MATRIX_HEIGHT - 1, colorRight);
39+
// drawFastVLine(x + bandCount, (MATRIX_HEIGHT - 1) - levelRight / levelsPerVerticalPixel, MATRIX_HEIGHT - 1, colorRight);
4040
}
4141

42-
return 0;
42+
return 1;
4343
}
4444

4545
uint16_t analyzerPixels() {
4646
fill_solid(leds, NUM_LEDS, CRGB::Black);
4747

4848
for (uint8_t bandIndex = 0; bandIndex < bandCount; bandIndex++) {
4949
int levelLeft = levelsLeft[bandIndex];
50-
int levelRight = levelsRight[bandIndex];
50+
// int levelRight = levelsRight[bandIndex];
5151

5252
if (drawPeaks) {
5353
levelLeft = peaksLeft[bandIndex];
54-
levelRight = peaksRight[bandIndex];
54+
// levelRight = peaksRight[bandIndex];
5555
}
5656

5757
CRGB colorLeft = ColorFromPalette(palette, levelLeft / levelsPerHue);
58-
CRGB colorRight = ColorFromPalette(palette, levelRight / levelsPerHue);
58+
// CRGB colorRight = ColorFromPalette(palette, levelRight / levelsPerHue);
5959

6060
uint8_t x = bandIndex + bandOffset;
6161
if (x >= MATRIX_WIDTH)
6262
x -= MATRIX_WIDTH;
6363

6464
leds[XY(x, (MATRIX_HEIGHT - 1) - levelLeft / levelsPerVerticalPixel)] = colorLeft;
65-
leds[XY(x + bandCount, (MATRIX_HEIGHT - 1) - levelLeft / levelsPerVerticalPixel)] = colorRight;
65+
// leds[XY(x + bandCount, (MATRIX_HEIGHT - 1) - levelLeft / levelsPerVerticalPixel)] = colorRight;
6666
}
6767

6868
return 0;
@@ -73,34 +73,34 @@ uint16_t fallingSpectrogram() {
7373

7474
for (uint8_t bandIndex = 0; bandIndex < bandCount; bandIndex++) {
7575
int levelLeft = levelsLeft[bandIndex];
76-
int levelRight = levelsRight[bandIndex];
76+
// int levelRight = levelsRight[bandIndex];
7777

7878
if (drawPeaks) {
7979
levelLeft = peaksLeft[bandIndex];
80-
levelRight = peaksRight[bandIndex];
80+
// levelRight = peaksRight[bandIndex];
8181
}
8282

8383
if (levelLeft <= 8) levelLeft = 0;
84-
if (levelRight <= 8) levelRight = 0;
84+
// if (levelRight <= 8) levelRight = 0;
8585

8686
CRGB colorLeft = ColorFromPalette(palette, levelLeft / levelsPerHue);
87-
CRGB colorRight = ColorFromPalette(palette, levelRight / levelsPerHue);
87+
// CRGB colorRight = ColorFromPalette(palette, levelRight / levelsPerHue);
8888

8989
if (currentPaletteIndex < 2) { // invert the first two palettes
9090
colorLeft = ColorFromPalette(palette, 205 - (levelLeft / 4 - 205));
91-
colorRight = ColorFromPalette(palette, 205 - (levelLeft / 4 - 205));
91+
// colorRight = ColorFromPalette(palette, 205 - (levelLeft / 4 - 205));
9292
}
9393
else {
9494
colorLeft = ColorFromPalette(palette, levelLeft / 4);
95-
colorRight = ColorFromPalette(palette, levelRight / 4);
95+
// colorRight = ColorFromPalette(palette, levelRight / 4);
9696
}
9797

9898
uint8_t x = bandIndex + bandOffset;
9999
if (x >= MATRIX_WIDTH)
100100
x -= MATRIX_WIDTH;
101101

102102
leds[XY(x, 0)] = colorLeft;
103-
leds[XY(x + bandCount, 0)] = colorRight;
103+
// leds[XY(x + bandCount, 0)] = colorRight;
104104
}
105105

106106
return 0;
@@ -115,10 +115,15 @@ uint16_t audioNoise() {
115115
noisescale = 30;
116116
colorLoop = 0;
117117

118-
// if(peaksLeft[0] > 896)
119-
noisespeedy = peaksLeft[0] / 64;
120-
// if(peaksRight[0] > 896)
121-
noisespeedz = peaksRight[0] / 256;
118+
static int lastPeak = 0;
119+
120+
if(peaksLeft[0] >= lastPeak) {
121+
noisespeedy = peaksLeft[0] / 32;
122+
}
123+
124+
noisespeedz = peaksLeft[0] / 128;
125+
126+
lastPeak = peaksLeft[0];
122127

123128
fillnoise8();
124129

Commands.h

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,21 @@
11
/*
2-
* Aurora: https://github.com/pixelmatix/aurora
3-
*
4-
* Copyright (c) 2014 Jason Coon
5-
*
6-
* Portions of this code are adapted from Craig Lindley's LightAppliance:
7-
* https://github.com/CraigLindley/LightAppliance
8-
* Copyright (c) 2014 Craig A. Lindley
9-
*
10-
* Permission is hereby granted, free of charge, to any person obtaining a copy of
11-
* this software and associated documentation files (the "Software"), to deal in
12-
* the Software without restriction, including without limitation the rights to
13-
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
14-
* the Software, and to permit persons to whom the Software is furnished to do so,
15-
* subject to the following conditions:
16-
*
17-
* The above copyright notice and this permission notice shall be included in all
18-
* copies or substantial portions of the Software.
19-
*
20-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
22-
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
23-
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
24-
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
25-
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26-
*/
27-
2+
* Torch
3+
* Copyright (C) 2015 Jason Coon
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU General Public License as published by
7+
* the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17+
*/
18+
2819
#ifndef IrCodes_H
2920
#define IrCodes_H
3021

Drawing.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
/*
2+
* Torch
3+
* Copyright (C) 2015 Jason Coon
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU General Public License as published by
7+
* the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17+
*/
18+
119
void drawCircle(int16_t x0, int16_t y0, uint16_t radius, const CRGB& color)
220
{
321
int a = radius, b = 0;

Effects.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
/*
2+
* Torch
3+
* Copyright (C) 2015 Jason Coon
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU General Public License as published by
7+
* the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17+
*/
18+
119
// give it a linear tail to the right
220
void streamRight(byte scale, int fromX = 0, int toX = MATRIX_WIDTH, int fromY = 0, int toY = MATRIX_HEIGHT)
321
{

GradientPalettes.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
// ColorWavesWithPalettes
2+
// Animated shifting color waves, with several cross-fading color palettes.
3+
// by Mark Kriegsman, August 2015
4+
//
5+
// Color palettes courtesy of cpt-city and its contributors:
6+
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/
7+
//
8+
// Color palettes converted for FastLED using "PaletteKnife" v1:
9+
// http://fastled.io/tools/paletteknife/
10+
//
11+
112
// Gradient Color Palette definitions for 33 different cpt-city color palettes.
213
// 956 bytes of PROGMEM for all of the palettes together,
314
// +618 bytes of PROGMEM for gradient palette code (AVR).

Noise.h

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
/*
2+
* Torch
3+
* Copyright (C) 2015 Jason Coon
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU General Public License as published by
7+
* the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17+
*/
18+
119
#define MAX_DIMENSION ((MATRIX_WIDTH > MATRIX_HEIGHT) ? MATRIX_WIDTH : MATRIX_HEIGHT)
220

321
// The 16 bit version of our coordinates
@@ -9,9 +27,9 @@ static uint16_t noisez;
927
// use the z-axis for "time". speed determines how fast time moves forward. Try
1028
// 1 for a very slow moving effect, or 60 for something that ends up looking like
1129
// water.
12-
uint16_t noisespeedx = 1;
13-
uint16_t noisespeedy = 1;
14-
uint16_t noisespeedz = 1;
30+
uint32_t noisespeedx = 1;
31+
uint32_t noisespeedy = 1;
32+
uint32_t noisespeedz = 1;
1533

1634
// Scale determines how far apart the pixels in our noise matrix are. Try
1735
// changing these values around to see how it affects the motion of the display. The

Pulse.h

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
1-
// Portions of this code are adapted from "NoiseSmearing" by Stefan Petrick: https://gist.github.com/StefanPetrick/9ee2f677dbff64e3ba7a
1+
/*
2+
* Torch
3+
* Copyright (C) 2015 Jason Coon
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU General Public License as published by
7+
* the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17+
*/
218

319
uint16_t pulse() {
420
// palette = RainbowColors_p;

0 commit comments

Comments
 (0)