1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2025-04-05 19:45:08 +00:00

avg offset better calc

This commit is contained in:
Cameron Taylor 2024-02-14 08:29:38 -05:00
parent d237bc88e4
commit 96d27c271a

View file

@ -38,7 +38,7 @@ class LatencyState extends MusicBeatSubState
var beatTrail:FlxSprite; var beatTrail:FlxSprite;
var diffGrp:FlxTypedGroup<FlxText>; var diffGrp:FlxTypedGroup<FlxText>;
var offsetsPerBeat:Array<Int> = []; var offsetsPerBeat:Array<Null<Int>> = [];
var swagSong:FlxSound; var swagSong:FlxSound;
var previousVolume:Float; var previousVolume:Float;
@ -101,7 +101,7 @@ class LatencyState extends MusicBeatSubState
offsetTxt.alpha = 0.5; offsetTxt.alpha = 0.5;
diffGrp.add(offsetTxt); diffGrp.add(offsetTxt);
offsetsPerBeat.push(0); offsetsPerBeat.push(null);
} }
songVisFollowAudio = new FlxSprite(0, FlxG.height - 20).makeGraphic(2, 20, FlxColor.YELLOW); songVisFollowAudio = new FlxSprite(0, FlxG.height - 20).makeGraphic(2, 20, FlxColor.YELLOW);
@ -248,10 +248,15 @@ class LatencyState extends MusicBeatSubState
var avgOffsetInput:Float = 0; var avgOffsetInput:Float = 0;
var loopInd:Int = 0;
for (offsetThing in offsetsPerBeat) for (offsetThing in offsetsPerBeat)
{
if (offsetThing == null) continue;
avgOffsetInput += offsetThing; avgOffsetInput += offsetThing;
loopInd++;
}
avgOffsetInput /= offsetsPerBeat.length; avgOffsetInput /= loopInd;
offsetText.text += "\n\nEstimated average input offset needed: " + avgOffsetInput; offsetText.text += "\n\nEstimated average input offset needed: " + avgOffsetInput;