1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-10 00:34:40 +00:00

more spectogram optimiz in progress

This commit is contained in:
Cameron Taylor 2022-02-09 14:00:04 -05:00
parent 0b9c9d7533
commit 96540fc09e
2 changed files with 8 additions and 7 deletions

View file

@ -27,13 +27,14 @@ class SpectogramSprite extends FlxTypedSpriteGroup<FlxSprite>
public var vis:VisShit; 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(); super();
vis = new VisShit(daSound); vis = new VisShit(daSound);
this.col = col; this.col = col;
this.daHeight = height; this.daHeight = height;
lengthOfShit = amnt;
regenLineShit(); regenLineShit();
@ -73,7 +74,7 @@ class SpectogramSprite extends FlxTypedSpriteGroup<FlxSprite>
forEach(spr -> 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! // if visType is static, call updateVisulizer() manually whenever you want to update it!

View file

@ -94,6 +94,7 @@ class ChartingState extends MusicBeatState
// trace(audioBuf.sampleRate); // trace(audioBuf.sampleRate);
gridBG = FlxGridOverlay.create(GRID_SIZE, GRID_SIZE, GRID_SIZE * 8, GRID_SIZE * 16); gridBG = FlxGridOverlay.create(GRID_SIZE, GRID_SIZE, GRID_SIZE * 8, GRID_SIZE * 16);
trace("GRD BG: " + gridBG.height);
add(gridBG); add(gridBG);
leftIcon = new HealthIcon('bf'); leftIcon = new HealthIcon('bf');
@ -417,9 +418,8 @@ class ChartingState extends MusicBeatState
FlxG.sound.playMusic(Paths.inst(daSong), 0.6); 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.x += 70;
musSpec.daHeight = FlxG.height / 2;
musSpec.scrollFactor.set(); musSpec.scrollFactor.set();
// musSpec.visType = FREQUENCIES; // musSpec.visType = FREQUENCIES;
add(musSpec); add(musSpec);
@ -447,7 +447,8 @@ class ChartingState extends MusicBeatState
for (index => voc in vocals.members) 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.x = 70 - (50 * index);
// vocalSpec.visType = FREQUENCIES; // vocalSpec.visType = FREQUENCIES;
vocalSpec.daHeight = musSpec.daHeight; vocalSpec.daHeight = musSpec.daHeight;
@ -455,14 +456,13 @@ class ChartingState extends MusicBeatState
vocalSpec.scrollFactor.set(); vocalSpec.scrollFactor.set();
add(vocalSpec); 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) if (index == 0)
staticVocal.x -= 150; staticVocal.x -= 150;
if (index == 1) if (index == 1)
staticVocal.x = gridBG.width; staticVocal.x = gridBG.width;
staticVocal.daHeight = GRID_SIZE * 16;
staticVocal.visType = STATIC; staticVocal.visType = STATIC;
staticSpecGrp.add(staticVocal); staticSpecGrp.add(staticVocal);
} }