@@ -44,7 +44,7 @@ class AudioPatterns : public Playlist {
44
44
45
45
AudioPatternFunctionPointer currentItem;
46
46
47
- static const int PATTERN_COUNT = 33 ;
47
+ static const int PATTERN_COUNT = 39 ;
48
48
49
49
AudioPatternFunctionPointer shuffledItems[PATTERN_COUNT];
50
50
@@ -55,16 +55,16 @@ class AudioPatterns : public Playlist {
55
55
&AudioPatterns::radar,
56
56
&AudioPatterns::gauge,
57
57
&AudioPatterns::gauge2,
58
- // &AudioPatterns::paletteSmear,
59
- // &AudioPatterns::bounce,
58
+ &AudioPatterns::paletteSmear,
59
+ &AudioPatterns::bounce,
60
60
&AudioPatterns::incrementalDrift,
61
61
&AudioPatterns::incrementalDrift2,
62
62
&AudioPatterns::pendulumWave,
63
63
&AudioPatterns::fire,
64
- // &AudioPatterns::analyzerPixelsWithNoiseSmearing,
65
- // &AudioPatterns::analyzerColumnsWithNoiseSmearing,
66
- // &AudioPatterns::randomEmittersWithNoiseSmearing,
67
- // &AudioPatterns::lineChartWithNoiseSmearing,
64
+ &AudioPatterns::analyzerPixelsWithNoiseSmearing,
65
+ &AudioPatterns::analyzerColumnsWithNoiseSmearing,
66
+ &AudioPatterns::randomEmittersWithNoiseSmearing,
67
+ &AudioPatterns::lineChartWithNoiseSmearing,
68
68
&AudioPatterns::analyzerPixelsWithOneLargeSpiral,
69
69
&AudioPatterns::analyzerPixelsWithFiveSpirals,
70
70
&AudioPatterns::analyzerPixelsWithStreamDown120,
@@ -196,15 +196,15 @@ class AudioPatterns : public Playlist {
196
196
drawAnalyzerPixels ();
197
197
}
198
198
199
- // void analyzerPixelsWithNoiseSmearing() {
200
- // effects.DimAll(235);
201
- //
202
- // drawAnalyzerPixels();
203
- //
204
- // effects.standardNoiseSmearing();
205
- //
206
- // peakDecay = 32;
207
- // }
199
+ void analyzerPixelsWithNoiseSmearing () {
200
+ effects.DimAll (235 );
201
+
202
+ drawAnalyzerPixels ();
203
+
204
+ effects.standardNoiseSmearing ();
205
+
206
+ peakDecay = 32 ;
207
+ }
208
208
209
209
void drawAnalyzerPixels () {
210
210
for (int x = 0 ; x < MATRIX_WIDTH; x++) {
@@ -240,15 +240,15 @@ class AudioPatterns : public Playlist {
240
240
analyzerLinesByIntensity ();
241
241
}
242
242
243
- // void lineChartWithNoiseSmearing() {
244
- // effects.DimAll(235);
245
- //
246
- // analyzerLinesByIntensity();
247
- //
248
- // effects.standardNoiseSmearing();
249
- //
250
- // peakDecay = 32;
251
- // }
243
+ void lineChartWithNoiseSmearing () {
244
+ effects.DimAll (235 );
245
+
246
+ analyzerLinesByIntensity ();
247
+
248
+ effects.standardNoiseSmearing ();
249
+
250
+ peakDecay = 32 ;
251
+ }
252
252
253
253
void lineChartWithSpiral () {
254
254
effects.SpiralStream (MATRIX_CENTRE_X, MATRIX_CENTRE_Y, MATRIX_WIDTH / 2 , 120 );
@@ -274,15 +274,15 @@ class AudioPatterns : public Playlist {
274
274
analyzerColumnsByIntensity ();
275
275
}
276
276
277
- // void analyzerColumnsWithNoiseSmearing() {
278
- // effects.DimAll(235);
279
- //
280
- // analyzerColumnsByIntensity();
281
- //
282
- // effects.standardNoiseSmearing();
283
- //
284
- // peakDecay = 32;
285
- // }
277
+ void analyzerColumnsWithNoiseSmearing () {
278
+ effects.DimAll (235 );
279
+
280
+ analyzerColumnsByIntensity ();
281
+
282
+ effects.standardNoiseSmearing ();
283
+
284
+ peakDecay = 32 ;
285
+ }
286
286
287
287
void analyzerColumnsWithOneLargeSpiralStream () {
288
288
effects.SpiralStream (MATRIX_CENTRE_X, MATRIX_CENTRE_Y, MATRIX_WIDTH / 2 , 120 );
@@ -456,15 +456,15 @@ class AudioPatterns : public Playlist {
456
456
drawRandomEmitters ();
457
457
}
458
458
459
- // void randomEmittersWithNoiseSmearing() {
460
- // effects.DimAll(235);
461
- //
462
- // drawRandomEmitters();
463
- //
464
- // effects.standardNoiseSmearing();
465
- //
466
- // peakDecay = 32;
467
- // }
459
+ void randomEmittersWithNoiseSmearing () {
460
+ effects.DimAll (235 );
461
+
462
+ drawRandomEmitters ();
463
+
464
+ effects.standardNoiseSmearing ();
465
+
466
+ peakDecay = 32 ;
467
+ }
468
468
469
469
void drawRandomEmitters () {
470
470
for (int i = 0 ; i < bandCount; i++) {
@@ -648,27 +648,27 @@ class AudioPatterns : public Playlist {
648
648
649
649
// calculate noise matrix
650
650
// x and y define the lower left point
651
- // void FillNoise() {
652
- // for (int i = 0; i < MATRIX_WIDTH; i++) {
653
- // int ioffset = scale * i;
654
- // for (int j = 0; j < MATRIX_HEIGHT; j++) {
655
- // int joffset = scale * j;
656
- // noise[i][j] = inoise8(x + ioffset, y + joffset, z);
657
- // }
658
- // }
659
- // }
651
+ void FillNoise () {
652
+ for (int i = 0 ; i < MATRIX_WIDTH; i++) {
653
+ int ioffset = scale * i;
654
+ for (int j = 0 ; j < MATRIX_HEIGHT; j++) {
655
+ int joffset = scale * j;
656
+ noise[i][j] = inoise8 (x + ioffset, y + joffset, z);
657
+ }
658
+ }
659
+ }
660
660
661
661
// calculate noise matrix
662
662
// x and y define the center
663
- // void FillNoiseCentral() {
664
- // for (int i = 0; i < MATRIX_WIDTH; i++) {
665
- // int ioffset = scale * (i - 8);
666
- // for (int j = 0; j < MATRIX_HEIGHT; j++) {
667
- // int joffset = scale * (j - 8);
668
- // noise[i][j] = inoise8(x + ioffset, y + joffset, z);
669
- // }
670
- // }
671
- // }
663
+ void FillNoiseCentral () {
664
+ for (int i = 0 ; i < MATRIX_WIDTH; i++) {
665
+ int ioffset = scale * (i - 8 );
666
+ for (int j = 0 ; j < MATRIX_HEIGHT; j++) {
667
+ int joffset = scale * (j - 8 );
668
+ noise[i][j] = inoise8 (x + ioffset, y + joffset, z);
669
+ }
670
+ }
671
+ }
672
672
673
673
int band5 = (int ) ((float ) bandCount * 0.75 );
674
674
@@ -984,75 +984,75 @@ class AudioPatterns : public Playlist {
984
984
}
985
985
}
986
986
987
- // PVector gravity = PVector(0, 0.0250);
988
- // PVector impulse = PVector(0, 0);
989
- // boolean startedAttractor = false;
990
- // void bounce() {
991
- // const int count = 32;
992
- //
993
- // if (!startedAttractor) {
994
- // startedAttractor = true;
995
- //
996
- // int direction = random(0, 2);
997
- // if (direction == 0)
998
- // direction = -1;
999
- //
1000
- // for (int i = 0; i < count; i++) {
1001
- // Boid boid = Boid(i, MATRIX_HEIGHT - 1);
1002
- // boid.velocity.x = 0;
1003
- // boid.velocity.y = 0;
1004
- // boid.maxforce = 10;
1005
- // boid.maxspeed = 10;
1006
- // boids[i] = boid;
1007
- // }
1008
- // }
1009
- //
1010
- // // dim all pixels on the display
1011
- // effects.DimAll(170);
1012
- //
1013
- // for (int i = 0; i < count; i++) {
1014
- // Boid boid = boids[i];
1015
- // boid.velocity.x = 0;
1016
- // boid.location.x = i;
1017
- // boid.applyForce(gravity);
1018
- //
1019
- // uint8_t bandIndex = i / 5;
1020
- //
1021
- // int level = levels[bandIndex];
1022
- // if (drawPeaks)
1023
- // level = peaks[bandIndex];
1024
- //
1025
- // if (boid.location.y == MATRIX_HEIGHT - 1) {
1026
- // impulse.y = - (float)random(level * .75, level) / 960.0F;
1027
- // boid.applyForce(impulse);
1028
- // }
1029
- //
1030
- // boid.update();
1031
- //
1032
- // boid.bounceOffBorders(0.2);
1033
- //
1034
- // boids[i] = boid;
1035
- //
1036
- // backgroundLayer.drawPixel(boid.location.x, boid.location.y, effects.ColorFromCurrentPalette(((MATRIX_HEIGHT - 1) - boid.location.y) * 7));
1037
- // }
1038
- // }
1039
-
1040
- // void paletteSmear() {
1041
- // effects.DimAll(170);
1042
- //
1043
- // // draw a rainbow color palette
1044
- // for (uint8_t y = 0; y < MATRIX_HEIGHT; y++) {
1045
- // for (uint8_t x = 0; x < MATRIX_WIDTH; x++) {
1046
- // int level = interpolatedLevels[x / horizontalPixelsPerBand];
1047
- //
1048
- // effects.leds[XY(x, y)] += effects.ColorFromCurrentPalette(level / 5, y * (256 / MATRIX_HEIGHT));
1049
- // }
1050
- // }
1051
- //
1052
- // effects.standardNoiseSmearing();
1053
- //
1054
- // peakDecay = 32;
1055
- // }
987
+ PVector gravity = PVector(0 , 0.0250 );
988
+ PVector impulse = PVector(0 , 0 );
989
+ boolean startedAttractor = false ;
990
+ void bounce () {
991
+ const int count = 32 ;
992
+
993
+ if (!startedAttractor) {
994
+ startedAttractor = true ;
995
+
996
+ int direction = random (0 , 2 );
997
+ if (direction == 0 )
998
+ direction = -1 ;
999
+
1000
+ for (int i = 0 ; i < count; i++) {
1001
+ Boid boid = Boid (i, MATRIX_HEIGHT - 1 );
1002
+ boid.velocity .x = 0 ;
1003
+ boid.velocity .y = 0 ;
1004
+ boid.maxforce = 10 ;
1005
+ boid.maxspeed = 10 ;
1006
+ boids[i] = boid;
1007
+ }
1008
+ }
1009
+
1010
+ // dim all pixels on the display
1011
+ effects.DimAll (170 );
1012
+
1013
+ for (int i = 0 ; i < count; i++) {
1014
+ Boid boid = boids[i];
1015
+ boid.velocity .x = 0 ;
1016
+ boid.location .x = i;
1017
+ boid.applyForce (gravity);
1018
+
1019
+ uint8_t bandIndex = i / 5 ;
1020
+
1021
+ int level = levels[bandIndex];
1022
+ if (drawPeaks)
1023
+ level = peaks[bandIndex];
1024
+
1025
+ if (boid.location .y == MATRIX_HEIGHT - 1 ) {
1026
+ impulse.y = - (float )random (level * .75 , level) / 960 .0F ;
1027
+ boid.applyForce (impulse);
1028
+ }
1029
+
1030
+ boid.update ();
1031
+
1032
+ boid.bounceOffBorders (0.2 );
1033
+
1034
+ boids[i] = boid;
1035
+
1036
+ backgroundLayer.drawPixel (boid.location .x , boid.location .y , effects.ColorFromCurrentPalette (((MATRIX_HEIGHT - 1 ) - boid.location .y ) * 7 ));
1037
+ }
1038
+ }
1039
+
1040
+ void paletteSmear () {
1041
+ effects.DimAll (170 );
1042
+
1043
+ // draw a rainbow color palette
1044
+ for (uint8_t y = 0 ; y < MATRIX_HEIGHT; y++) {
1045
+ for (uint8_t x = 0 ; x < MATRIX_WIDTH; x++) {
1046
+ int level = interpolatedLevels[x / horizontalPixelsPerBand];
1047
+
1048
+ effects.leds [XY (x, y)] += effects.ColorFromCurrentPalette (level / 5 , y * (256 / MATRIX_HEIGHT));
1049
+ }
1050
+ }
1051
+
1052
+ effects.standardNoiseSmearing ();
1053
+
1054
+ peakDecay = 32 ;
1055
+ }
1056
1056
1057
1057
void gauge () {
1058
1058
blur2d ( effects.leds , MATRIX_WIDTH, MATRIX_HEIGHT, 10 );
0 commit comments