public void Visualize() { if (this.stopwatch.ElapsedMilliseconds <= 1000) { return; } this.stopwatch.Restart(); int triangles = this.config.stageSideLengths.Length / 3; for (int i = 0; i < triangles; i++) { int tracerIndex = LEDStageTracerVisualizer.TracerLEDIndex( this.config, i ); int triangleCounter = 0; int maxTriangleCounter = this.config.stageSideLengths[i * 3] + this.config.stageSideLengths[i * 3 + 1] + this.config.stageSideLengths[i * 3 + 2]; for (int j = 0; j < 3; j++) { for ( int k = 0; k < this.config.stageSideLengths[i * 3 + j]; k++, triangleCounter++ ) { bool secondPart = this.sideParts[i * 3 + j] ^ (this.config.beatBroadcaster.ProgressThroughBeat(0.25) > 0.5); int color = this.stage.GetGradientColor( secondPart ? 1 : 0, (double)triangleCounter / maxTriangleCounter, (double)tracerIndex / maxTriangleCounter, true ); int dimmedColor = LEDColor.ScaleColor( color, this.audio.LevelForChannel(secondPart ? 2 : 1) ); for (int l = 0; l < 3; l++) { this.stage.SetPixel(i * 3 + j, k, l, dimmedColor); } } } } this.stage.Flush(); }
public void Visualize() { if (this.stopwatch.ElapsedMilliseconds <= 10) { return; } this.stopwatch.Restart(); int triangles = this.config.stageSideLengths.Length / 3; for (int i = 0; i < triangles; i++) { int tracerIndex = LEDStageTracerVisualizer.TracerLEDIndex( this.config, i ); int triangleCounter = 0; for (int j = 0; j < 3; j++) { for ( int k = 0; k < this.config.stageSideLengths[i * 3 + j]; k++, triangleCounter++ ) { int color = triangleCounter == tracerIndex ? this.stage.GetSingleColor(0) : this.stage.GetSingleColor(1); for (int l = 0; l < 3; l++) { this.stage.SetPixel(i * 3 + j, k, l, color); } } } } this.stage.Flush(); }