From 96540fc09e8283a25e24f6f50520d8c1b093bad0 Mon Sep 17 00:00:00 2001
From: Cameron Taylor <cameron.taylor.ninja@gmail.com>
Date: Wed, 9 Feb 2022 14:00:04 -0500
Subject: [PATCH] more spectogram optimiz in progress

---
 source/SpectogramSprite.hx       |  5 +++--
 source/charting/ChartingState.hx | 10 +++++-----
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/source/SpectogramSprite.hx b/source/SpectogramSprite.hx
index 5ad530b97..06cee5465 100644
--- a/source/SpectogramSprite.hx
+++ b/source/SpectogramSprite.hx
@@ -27,13 +27,14 @@ class SpectogramSprite extends FlxTypedSpriteGroup<FlxSprite>
 
 	public var vis:VisShit;
 
-	public function new(daSound:FlxSound, ?col:FlxColor = FlxColor.WHITE, ?height:Float = 720)
+	public function new(daSound:FlxSound, ?col:FlxColor = FlxColor.WHITE, ?height:Float = 720, ?amnt:Int = 500)
 	{
 		super();
 
 		vis = new VisShit(daSound);
 		this.col = col;
 		this.daHeight = height;
+		lengthOfShit = amnt;
 
 		regenLineShit();
 
@@ -73,7 +74,7 @@ class SpectogramSprite extends FlxTypedSpriteGroup<FlxSprite>
 
 		forEach(spr ->
 		{
-			spr.visible = FlxG.game.ticks % wavOptimiz == spr.ID % wavOptimiz;
+			spr.visible = spr.ID % wavOptimiz == 0;
 		});
 
 		// if visType is static, call updateVisulizer() manually whenever you want to update it!
diff --git a/source/charting/ChartingState.hx b/source/charting/ChartingState.hx
index 185c3dee6..1157f88e4 100644
--- a/source/charting/ChartingState.hx
+++ b/source/charting/ChartingState.hx
@@ -94,6 +94,7 @@ class ChartingState extends MusicBeatState
 		// trace(audioBuf.sampleRate);
 
 		gridBG = FlxGridOverlay.create(GRID_SIZE, GRID_SIZE, GRID_SIZE * 8, GRID_SIZE * 16);
+		trace("GRD BG: " + gridBG.height);
 		add(gridBG);
 
 		leftIcon = new HealthIcon('bf');
@@ -417,9 +418,8 @@ class ChartingState extends MusicBeatState
 
 		FlxG.sound.playMusic(Paths.inst(daSong), 0.6);
 
-		var musSpec:SpectogramSprite = new SpectogramSprite(FlxG.sound.music, FlxColor.RED);
+		var musSpec:SpectogramSprite = new SpectogramSprite(FlxG.sound.music, FlxColor.RED, FlxG.height / 2, Math.floor(FlxG.height / 2));
 		musSpec.x += 70;
-		musSpec.daHeight = FlxG.height / 2;
 		musSpec.scrollFactor.set();
 		// musSpec.visType = FREQUENCIES;
 		add(musSpec);
@@ -447,7 +447,8 @@ class ChartingState extends MusicBeatState
 
 		for (index => voc in vocals.members)
 		{
-			var vocalSpec:SpectogramSprite = new SpectogramSprite(voc, FlxG.random.color(0xFFAAAAAA, FlxColor.WHITE, 100));
+			var vocalSpec:SpectogramSprite = new SpectogramSprite(voc, FlxG.random.color(0xFFAAAAAA, FlxColor.WHITE, 100), musSpec.daHeight,
+				Math.floor(FlxG.height / 2));
 			vocalSpec.x = 70 - (50 * index);
 			// vocalSpec.visType = FREQUENCIES;
 			vocalSpec.daHeight = musSpec.daHeight;
@@ -455,14 +456,13 @@ class ChartingState extends MusicBeatState
 			vocalSpec.scrollFactor.set();
 			add(vocalSpec);
 
-			var staticVocal:SpectogramSprite = new SpectogramSprite(voc, FlxG.random.color(0xFFAAAAAA, FlxColor.WHITE, 100));
+			var staticVocal:SpectogramSprite = new SpectogramSprite(voc, FlxG.random.color(0xFFAAAAAA, FlxColor.WHITE, 100), GRID_SIZE * 16, GRID_SIZE * 8);
 			if (index == 0)
 				staticVocal.x -= 150;
 
 			if (index == 1)
 				staticVocal.x = gridBG.width;
 
-			staticVocal.daHeight = GRID_SIZE * 16;
 			staticVocal.visType = STATIC;
 			staticSpecGrp.add(staticVocal);
 		}