timertools -> timerutil fix

This commit is contained in:
Cameron Taylor 2024-03-13 18:47:15 -07:00
parent 1a224423f9
commit b9ab38e0b9
7 changed files with 41 additions and 41 deletions

View file

@ -30,7 +30,7 @@ import funkin.modding.module.ModuleHandler;
import funkin.ui.title.TitleState;
import funkin.util.CLIUtil;
import funkin.util.CLIUtil.CLIParams;
import funkin.util.tools.TimerTools;
import funkin.util.TimerUtil;
import funkin.ui.transition.LoadingState;
import funkin.util.TrackerUtil;
#if discord_rpc
@ -221,7 +221,7 @@ class InitState extends FlxState
// NOTE: Registries must be imported and not referenced with fully qualified names,
// to ensure build macros work properly.
trace('Parsing game data...');
var perfStart:Float = TimerTools.start();
var perfStart:Float = TimerUtil.start();
SongEventRegistry.loadEventCache(); // SongEventRegistry is structured differently so it's not a BaseRegistry.
SongRegistry.instance.loadEntries();
LevelRegistry.instance.loadEntries();
@ -238,7 +238,7 @@ class InitState extends FlxState
ModuleHandler.loadModuleCache();
ModuleHandler.callOnCreate();
trace('Parsing game data took: ${TimerTools.ms(perfStart)}');
trace('Parsing game data took: ${TimerUtil.ms(perfStart)}');
}
/**

View file

@ -1,6 +1,6 @@
package funkin.audio.waveform;
import funkin.util.tools.TimerTools;
import funkin.util.TimerUtil;
class WaveformDataParser
{
@ -73,7 +73,7 @@ class WaveformDataParser
var outputData:Array<Int> = [];
var perfStart:Float = TimerTools.start();
var perfStart:Float = TimerUtil.start();
for (pointIndex in 0...outputPointCount)
{
@ -110,7 +110,7 @@ class WaveformDataParser
var outputDataLength:Int = Std.int(outputData.length / channels / 2);
var result = new WaveformData(null, channels, sampleRate, samplesPerPoint, bitsPerSample, outputPointCount, outputData);
trace('[WAVEFORM] Interpreted audio buffer in ${TimerTools.seconds(perfStart)}.');
trace('[WAVEFORM] Interpreted audio buffer in ${TimerUtil.seconds(perfStart)}.');
return result;
}

View file

@ -6,7 +6,7 @@ import flixel.tweens.FlxTween;
import flixel.util.FlxDirection;
import funkin.graphics.FunkinSprite;
import funkin.play.PlayState;
import funkin.util.tools.TimerTools;
import funkin.util.TimerUtil;
class PopUpStuff extends FlxTypedGroup<FlxSprite>
{
@ -17,7 +17,7 @@ class PopUpStuff extends FlxTypedGroup<FlxSprite>
public function displayRating(daRating:String)
{
var perfStart:Float = TimerTools.start();
var perfStart:Float = TimerUtil.start();
if (daRating == null) daRating = "good";
@ -59,12 +59,12 @@ class PopUpStuff extends FlxTypedGroup<FlxSprite>
startDelay: Conductor.instance.beatLengthMs * 0.001
});
trace('displayRating took: ${TimerTools.seconds(perfStart)}');
trace('displayRating took: ${TimerUtil.seconds(perfStart)}');
}
public function displayCombo(?combo:Int = 0):Int
{
var perfStart:Float = TimerTools.start();
var perfStart:Float = TimerUtil.start();
if (combo == null) combo = 0;
@ -157,7 +157,7 @@ class PopUpStuff extends FlxTypedGroup<FlxSprite>
daLoop++;
}
trace('displayCombo took: ${TimerTools.seconds(perfStart)}');
trace('displayCombo took: ${TimerUtil.seconds(perfStart)}');
return combo;
}

View file

@ -7,7 +7,7 @@ import funkin.audio.FunkinSound;
import funkin.play.character.BaseCharacter.CharacterType;
import funkin.util.FileUtil;
import funkin.util.assets.SoundUtil;
import funkin.util.tools.TimerTools;
import funkin.util.TimerUtil;
import funkin.audio.waveform.WaveformData;
import funkin.audio.waveform.WaveformDataParser;
import funkin.audio.waveform.WaveformSprite;
@ -129,41 +129,41 @@ class ChartEditorAudioHandler
public static function switchToInstrumental(state:ChartEditorState, instId:String = '', playerId:String, opponentId:String):Bool
{
var perfA:Float = TimerTools.start();
var perfA:Float = TimerUtil.start();
var result:Bool = playInstrumental(state, instId);
if (!result) return false;
var perfB:Float = TimerTools.start();
var perfB:Float = TimerUtil.start();
stopExistingVocals(state);
var perfC:Float = TimerTools.start();
var perfC:Float = TimerUtil.start();
result = playVocals(state, BF, playerId, instId);
var perfD:Float = TimerTools.start();
var perfD:Float = TimerUtil.start();
// if (!result) return false;
result = playVocals(state, DAD, opponentId, instId);
// if (!result) return false;
var perfE:Float = TimerTools.start();
var perfE:Float = TimerUtil.start();
state.hardRefreshOffsetsToolbox();
var perfF:Float = TimerTools.start();
var perfF:Float = TimerUtil.start();
state.hardRefreshFreeplayToolbox();
var perfG:Float = TimerTools.start();
var perfG:Float = TimerUtil.start();
trace('Switched to instrumental in ${TimerTools.seconds(perfA, perfB)}.');
trace('Stopped existing vocals in ${TimerTools.seconds(perfB, perfC)}.');
trace('Played BF vocals in ${TimerTools.seconds(perfC, perfD)}.');
trace('Played DAD vocals in ${TimerTools.seconds(perfD, perfE)}.');
trace('Hard refreshed offsets toolbox in ${TimerTools.seconds(perfE, perfF)}.');
trace('Hard refreshed freeplay toolbox in ${TimerTools.seconds(perfF, perfG)}.');
trace('Switched to instrumental in ${TimerUtil.seconds(perfA, perfB)}.');
trace('Stopped existing vocals in ${TimerUtil.seconds(perfB, perfC)}.');
trace('Played BF vocals in ${TimerUtil.seconds(perfC, perfD)}.');
trace('Played DAD vocals in ${TimerUtil.seconds(perfD, perfE)}.');
trace('Hard refreshed offsets toolbox in ${TimerUtil.seconds(perfE, perfF)}.');
trace('Hard refreshed freeplay toolbox in ${TimerUtil.seconds(perfF, perfG)}.');
return true;
}
@ -175,9 +175,9 @@ class ChartEditorAudioHandler
{
if (instId == '') instId = 'default';
var instTrackData:Null<Bytes> = state.audioInstTrackData.get(instId);
var perfStart:Float = TimerTools.start();
var perfStart:Float = TimerUtil.start();
var instTrack:Null<FunkinSound> = SoundUtil.buildSoundFromBytes(instTrackData);
trace('Built instrumental track in ${TimerTools.seconds(perfStart)} seconds.');
trace('Built instrumental track in ${TimerUtil.seconds(perfStart)} seconds.');
if (instTrack == null) return false;
stopExistingInstrumental(state);
@ -205,9 +205,9 @@ class ChartEditorAudioHandler
{
var trackId:String = '${charId}${instId == '' ? '' : '-${instId}'}';
var vocalTrackData:Null<Bytes> = state.audioVocalTrackData.get(trackId);
var perfStart:Float = TimerTools.start();
var perfStart:Float = TimerUtil.start();
var vocalTrack:Null<FunkinSound> = SoundUtil.buildSoundFromBytes(vocalTrackData);
trace('Built vocal track in ${TimerTools.seconds(perfStart)}.');
trace('Built vocal track in ${TimerUtil.seconds(perfStart)}.');
if (state.audioVocalTrackGroup == null) state.audioVocalTrackGroup = new VoicesGroup();
@ -218,9 +218,9 @@ class ChartEditorAudioHandler
case BF:
state.audioVocalTrackGroup.addPlayerVoice(vocalTrack);
var perfStart:Float = TimerTools.start();
var perfStart:Float = TimerUtil.start();
var waveformData:Null<WaveformData> = vocalTrack.waveformData;
trace('Interpreted waveform data in ${TimerTools.seconds(perfStart)}.');
trace('Interpreted waveform data in ${TimerUtil.seconds(perfStart)}.');
if (waveformData != null)
{
@ -244,9 +244,9 @@ class ChartEditorAudioHandler
case DAD:
state.audioVocalTrackGroup.addOpponentVoice(vocalTrack);
var perfStart:Float = TimerTools.start();
var perfStart:Float = TimerUtil.start();
var waveformData:Null<WaveformData> = vocalTrack.waveformData;
trace('Interpreted waveform data in ${TimerTools.seconds(perfStart)}.');
trace('Interpreted waveform data in ${TimerUtil.seconds(perfStart)}.');
if (waveformData != null)
{

View file

@ -7,7 +7,7 @@ import funkin.audio.waveform.WaveformDataParser;
import funkin.ui.debug.charting.commands.SetFreeplayPreviewCommand;
import funkin.ui.haxeui.components.WaveformPlayer;
import funkin.ui.freeplay.FreeplayState;
import funkin.util.tools.TimerTools;
import funkin.util.TimerUtil;
import haxe.ui.backend.flixel.components.SpriteWrapper;
import haxe.ui.components.Button;
import haxe.ui.components.HorizontalSlider;
@ -289,12 +289,12 @@ class ChartEditorFreeplayToolbox extends ChartEditorBaseToolbox
// Build player waveform.
// waveformMusic.waveform.forceUpdate = true;
var perfStart:Float = TimerTools.start();
var perfStart:Float = TimerUtil.start();
var waveformData1 = playerVoice?.waveformData;
var waveformData2 = opponentVoice?.waveformData ?? playerVoice?.waveformData; // this null check is for songs that only have 1 vocals file!
var waveformData3 = chartEditorState.audioInstTrack.waveformData;
var waveformData = waveformData3.merge(waveformData1).merge(waveformData2);
trace('Waveform data merging took: ${TimerTools.seconds(perfStart)}');
trace('Waveform data merging took: ${TimerUtil.seconds(perfStart)}');
waveformMusic.waveform.waveformData = waveformData;
// Set the width and duration to render the full waveform, with the clipRect applied we only render a segment of it.

View file

@ -1,9 +1,9 @@
package funkin.util.tools;
package funkin.util;
import funkin.util.tools.FloatTools;
import haxe.Timer;
class TimerTools
class TimerUtil
{
public static function start():Float
{

View file

@ -1,7 +1,7 @@
package funkin.util.plugins;
import flixel.FlxBasic;
import funkin.util.tools.TimerTools;
import funkin.util.TimerUtil;
/**
* A plugin which adds functionality to press `Ins` to immediately perform memory garbage collection.
@ -24,9 +24,9 @@ class MemoryGCPlugin extends FlxBasic
if (FlxG.keys.justPressed.INSERT)
{
var perfStart:Float = TimerTools.start();
var perfStart:Float = TimerUtil.start();
funkin.util.MemoryUtil.collect(true);
trace('Memory GC took: ${TimerTools.seconds(perfStart)}');
trace('Memory GC took: ${TimerUtil.seconds(perfStart)}');
}
}