Skip to content

Commit

Permalink
Updated file headers.
Browse files Browse the repository at this point in the history
  • Loading branch information
jasoncoon committed Dec 18, 2015
1 parent a1e1979 commit 468c73f
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 64 deletions.
15 changes: 7 additions & 8 deletions AudioPatterns.h
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
/*
* Torch
* Torch: https://github.com/evilgeniuslabs/torch
* Copyright (C) 2015 Jason Coon
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

uint16_t analyzerColumns() {
fill_solid(leds, NUM_LEDS, CRGB::Black);

Expand Down Expand Up @@ -116,13 +116,13 @@ uint16_t audioNoise() {
colorLoop = 0;

static int lastPeak = 0;

if(peaksLeft[0] >= lastPeak) {
noisespeedy = peaksLeft[0] / 32;
}

noisespeedz = peaksLeft[0] / 128;

lastPeak = peaksLeft[0];

fillnoise8();
Expand All @@ -149,4 +149,3 @@ uint16_t audioNoise() {

return 0;
}

12 changes: 6 additions & 6 deletions Commands.h
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
/*
* Torch
* Torch: https://github.com/evilgeniuslabs/torch
* Copyright (C) 2015 Jason Coon
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef IrCodes_H
#define IrCodes_H

Expand Down Expand Up @@ -82,7 +82,7 @@ enum class InputCommand {

// IR Raw Key Codes for SparkFun remote
#define IRCODE_SPARKFUN_POWER 0x10EFD827 // 284153895
#define IRCODE_SPARKFUN_A 0x10EFF807 //
#define IRCODE_SPARKFUN_A 0x10EFF807 //
#define IRCODE_SPARKFUN_B 0x10EF7887
#define IRCODE_SPARKFUN_C 0x10EF58A7
#define IRCODE_SPARKFUN_UP 0x10EFA05F // 284139615
Expand Down
10 changes: 5 additions & 5 deletions Drawing.h
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
/*
* Torch
* Torch: https://github.com/evilgeniuslabs/torch
* Copyright (C) 2015 Jason Coon
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

void drawCircle(int16_t x0, int16_t y0, uint16_t radius, const CRGB& color)
{
int a = radius, b = 0;
Expand Down
10 changes: 5 additions & 5 deletions Effects.h
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
/*
* Torch
* Torch: https://github.com/evilgeniuslabs/torch
* Copyright (C) 2015 Jason Coon
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

// give it a linear tail to the right
void streamRight(byte scale, int fromX = 0, int toX = MATRIX_WIDTH, int fromY = 0, int toY = MATRIX_HEIGHT)
{
Expand Down
49 changes: 24 additions & 25 deletions Noise.h
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
/*
* Torch
* Torch: https://github.com/evilgeniuslabs/torch
* Copyright (C) 2015 Jason Coon
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
Expand Down Expand Up @@ -96,7 +96,7 @@ void fillnoise8() {
noisey = random16();
noisez = random16();
}

// If we're runing at a low "speed", some 8-bit artifacts become visible
// from frame-to-frame. In order to reduce this, we can do some fast data-smoothing.
// The amount of data smoothing we're doing depends on "speed".
Expand All @@ -106,12 +106,12 @@ void fillnoise8() {
if( lowestNoise < 8) {
dataSmoothing = 200 - (lowestNoise * 4);
}

for(int i = 0; i < MAX_DIMENSION; i++) {
int ioffset = noisescale * i;
for(int j = 0; j < MAX_DIMENSION; j++) {
int joffset = noisescale * j;

uint8_t data = inoise8(noisex + ioffset, noisey + joffset, noisez);

// The range of the inoise8 function is roughly 16-238.
Expand All @@ -125,11 +125,11 @@ void fillnoise8() {
uint8_t newdata = scale8( olddata, dataSmoothing) + scale8( data, 256 - dataSmoothing);
data = newdata;
}

noise[i][j] = data;
}
}

noisex += noisespeedx;
noisey += noisespeedy;
noisez += noisespeedz;
Expand All @@ -138,7 +138,7 @@ void fillnoise8() {
void mapNoiseToLEDsUsingPalette(CRGBPalette16 palette, uint8_t hueReduce = 0)
{
static uint8_t ihue=0;

for(int i = 0; i < MATRIX_WIDTH; i++) {
for(int j = 0; j < MATRIX_HEIGHT; j++) {
// We use the value at the (i,j) coordinate in the noise
Expand All @@ -149,11 +149,11 @@ void mapNoiseToLEDsUsingPalette(CRGBPalette16 palette, uint8_t hueReduce = 0)
uint8_t bri = noise[i][j];

// if this palette is a 'loop', add a slowly-changing base value
if( colorLoop) {
if( colorLoop) {
index += ihue;
}

// brighten up, as the color palette itself often contains the
// brighten up, as the color palette itself often contains the
// light/dark dynamic range desired
if( bri > 127 ) {
bri = 255;
Expand All @@ -172,14 +172,14 @@ void mapNoiseToLEDsUsingPalette(CRGBPalette16 palette, uint8_t hueReduce = 0)
leds[n] = color;
}
}

ihue+=1;
}

uint16_t drawNoise(CRGBPalette16 palette,uint8_t hueReduce = 0) {
// generate noise data
fillnoise8();

// convert the noise data to colors in the LED array
// using the current palette
mapNoiseToLEDsUsingPalette(palette, hueReduce);
Expand All @@ -192,7 +192,7 @@ uint16_t rainbowNoise() {
noisespeedy = 0;
noisespeedz = 0;
noisescale = 30;
colorLoop = 0;
colorLoop = 0;
return drawNoise(RainbowColors_p);
}

Expand All @@ -201,7 +201,7 @@ uint16_t rainbowStripeNoise() {
noisespeedy = 0;
noisespeedz = 0;
noisescale = 20;
colorLoop = 0;
colorLoop = 0;
return drawNoise(RainbowStripeColors_p);
}

Expand All @@ -210,7 +210,7 @@ uint16_t partyNoise() {
noisespeedy = 0;
noisespeedz = 0;
noisescale = 30;
colorLoop = 0;
colorLoop = 0;
return drawNoise(PartyColors_p);
}

Expand All @@ -219,7 +219,7 @@ uint16_t forestNoise() {
noisespeedy = 0;
noisespeedz = 0;
noisescale = 120;
colorLoop = 0;
colorLoop = 0;
return drawNoise(ForestColors_p);
}

Expand All @@ -228,7 +228,7 @@ uint16_t cloudNoise() {
noisespeedy = 0;
noisespeedz = 0;
noisescale = 30;
colorLoop = 0;
colorLoop = 0;
return drawNoise(CloudColors_p);
}

Expand All @@ -237,7 +237,7 @@ uint16_t fireNoise() {
noisespeedy = 0;
noisespeedz = 8;
noisescale = 50;
colorLoop = 0;
colorLoop = 0;
return drawNoise(HeatColors_p, 60);
}

Expand All @@ -246,7 +246,7 @@ uint16_t lavaNoise() {
noisespeedy = 0;
noisespeedz = 16;
noisescale = 50;
colorLoop = 0;
colorLoop = 0;
return drawNoise(LavaColors_p);
}

Expand All @@ -255,7 +255,7 @@ uint16_t oceanNoise() {
noisespeedy = 0;
noisespeedz = 0;
noisescale = 90;
colorLoop = 0;
colorLoop = 0;
return drawNoise(OceanColors_p);
}

Expand All @@ -265,7 +265,7 @@ uint16_t blackAndWhiteNoise() {
noisespeedy = 0;
noisespeedz = 0;
noisescale = 30;
colorLoop = 0;
colorLoop = 0;
return drawNoise(blackAndWhiteStripedPalette);
}

Expand All @@ -275,7 +275,6 @@ uint16_t blackAndBlueNoise() {
noisespeedy = 0;
noisespeedz = 0;
noisescale = 30;
colorLoop = 0;
colorLoop = 0;
return drawNoise(blackAndBlueStripedPalette);
}

19 changes: 9 additions & 10 deletions Pulse.h
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
/*
* Torch
* Torch: https://github.com/evilgeniuslabs/torch
* Copyright (C) 2015 Jason Coon
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

uint16_t pulse() {
// palette = RainbowColors_p;

static uint8_t hue = 0;
static uint8_t centerX = 0;
static uint8_t centerY = 0;
static uint8_t step = 0;

static const uint8_t maxSteps = 16;
static const float fadeRate = 0.8;

Expand All @@ -33,15 +33,15 @@ uint16_t pulse() {
centerX = random(32);
centerY = random(32);
hue = random(256); // 170;

drawCircle(centerX, centerY, step, ColorFromPalette(palette, hue));
step++;
}
else {
if (step < maxSteps) {
// initial pulse
drawCircle(centerX, centerY, step, ColorFromPalette(palette, hue, pow(fadeRate, step - 2) * 255));

// secondary pulse
if (step > 3) {
drawCircle(centerX, centerY, step - 3, ColorFromPalette(palette, hue, pow(fadeRate, step - 2) * 255));
Expand All @@ -52,7 +52,6 @@ uint16_t pulse() {
step = 0;
}
}

return 30;
}

Loading

0 comments on commit 468c73f

Please sign in to comment.