mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2024-11-23 08:07:54 -05:00
timertools -> timerutil fix
This commit is contained in:
parent
1a224423f9
commit
b9ab38e0b9
7 changed files with 41 additions and 41 deletions
|
@ -30,7 +30,7 @@ import funkin.modding.module.ModuleHandler;
|
||||||
import funkin.ui.title.TitleState;
|
import funkin.ui.title.TitleState;
|
||||||
import funkin.util.CLIUtil;
|
import funkin.util.CLIUtil;
|
||||||
import funkin.util.CLIUtil.CLIParams;
|
import funkin.util.CLIUtil.CLIParams;
|
||||||
import funkin.util.tools.TimerTools;
|
import funkin.util.TimerUtil;
|
||||||
import funkin.ui.transition.LoadingState;
|
import funkin.ui.transition.LoadingState;
|
||||||
import funkin.util.TrackerUtil;
|
import funkin.util.TrackerUtil;
|
||||||
#if discord_rpc
|
#if discord_rpc
|
||||||
|
@ -221,7 +221,7 @@ class InitState extends FlxState
|
||||||
// NOTE: Registries must be imported and not referenced with fully qualified names,
|
// NOTE: Registries must be imported and not referenced with fully qualified names,
|
||||||
// to ensure build macros work properly.
|
// to ensure build macros work properly.
|
||||||
trace('Parsing game data...');
|
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.
|
SongEventRegistry.loadEventCache(); // SongEventRegistry is structured differently so it's not a BaseRegistry.
|
||||||
SongRegistry.instance.loadEntries();
|
SongRegistry.instance.loadEntries();
|
||||||
LevelRegistry.instance.loadEntries();
|
LevelRegistry.instance.loadEntries();
|
||||||
|
@ -238,7 +238,7 @@ class InitState extends FlxState
|
||||||
ModuleHandler.loadModuleCache();
|
ModuleHandler.loadModuleCache();
|
||||||
ModuleHandler.callOnCreate();
|
ModuleHandler.callOnCreate();
|
||||||
|
|
||||||
trace('Parsing game data took: ${TimerTools.ms(perfStart)}');
|
trace('Parsing game data took: ${TimerUtil.ms(perfStart)}');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package funkin.audio.waveform;
|
package funkin.audio.waveform;
|
||||||
|
|
||||||
import funkin.util.tools.TimerTools;
|
import funkin.util.TimerUtil;
|
||||||
|
|
||||||
class WaveformDataParser
|
class WaveformDataParser
|
||||||
{
|
{
|
||||||
|
@ -73,7 +73,7 @@ class WaveformDataParser
|
||||||
|
|
||||||
var outputData:Array<Int> = [];
|
var outputData:Array<Int> = [];
|
||||||
|
|
||||||
var perfStart:Float = TimerTools.start();
|
var perfStart:Float = TimerUtil.start();
|
||||||
|
|
||||||
for (pointIndex in 0...outputPointCount)
|
for (pointIndex in 0...outputPointCount)
|
||||||
{
|
{
|
||||||
|
@ -110,7 +110,7 @@ class WaveformDataParser
|
||||||
var outputDataLength:Int = Std.int(outputData.length / channels / 2);
|
var outputDataLength:Int = Std.int(outputData.length / channels / 2);
|
||||||
var result = new WaveformData(null, channels, sampleRate, samplesPerPoint, bitsPerSample, outputPointCount, outputData);
|
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;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ import flixel.tweens.FlxTween;
|
||||||
import flixel.util.FlxDirection;
|
import flixel.util.FlxDirection;
|
||||||
import funkin.graphics.FunkinSprite;
|
import funkin.graphics.FunkinSprite;
|
||||||
import funkin.play.PlayState;
|
import funkin.play.PlayState;
|
||||||
import funkin.util.tools.TimerTools;
|
import funkin.util.TimerUtil;
|
||||||
|
|
||||||
class PopUpStuff extends FlxTypedGroup<FlxSprite>
|
class PopUpStuff extends FlxTypedGroup<FlxSprite>
|
||||||
{
|
{
|
||||||
|
@ -17,7 +17,7 @@ class PopUpStuff extends FlxTypedGroup<FlxSprite>
|
||||||
|
|
||||||
public function displayRating(daRating:String)
|
public function displayRating(daRating:String)
|
||||||
{
|
{
|
||||||
var perfStart:Float = TimerTools.start();
|
var perfStart:Float = TimerUtil.start();
|
||||||
|
|
||||||
if (daRating == null) daRating = "good";
|
if (daRating == null) daRating = "good";
|
||||||
|
|
||||||
|
@ -59,12 +59,12 @@ class PopUpStuff extends FlxTypedGroup<FlxSprite>
|
||||||
startDelay: Conductor.instance.beatLengthMs * 0.001
|
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
|
public function displayCombo(?combo:Int = 0):Int
|
||||||
{
|
{
|
||||||
var perfStart:Float = TimerTools.start();
|
var perfStart:Float = TimerUtil.start();
|
||||||
|
|
||||||
if (combo == null) combo = 0;
|
if (combo == null) combo = 0;
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ class PopUpStuff extends FlxTypedGroup<FlxSprite>
|
||||||
daLoop++;
|
daLoop++;
|
||||||
}
|
}
|
||||||
|
|
||||||
trace('displayCombo took: ${TimerTools.seconds(perfStart)}');
|
trace('displayCombo took: ${TimerUtil.seconds(perfStart)}');
|
||||||
|
|
||||||
return combo;
|
return combo;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ import funkin.audio.FunkinSound;
|
||||||
import funkin.play.character.BaseCharacter.CharacterType;
|
import funkin.play.character.BaseCharacter.CharacterType;
|
||||||
import funkin.util.FileUtil;
|
import funkin.util.FileUtil;
|
||||||
import funkin.util.assets.SoundUtil;
|
import funkin.util.assets.SoundUtil;
|
||||||
import funkin.util.tools.TimerTools;
|
import funkin.util.TimerUtil;
|
||||||
import funkin.audio.waveform.WaveformData;
|
import funkin.audio.waveform.WaveformData;
|
||||||
import funkin.audio.waveform.WaveformDataParser;
|
import funkin.audio.waveform.WaveformDataParser;
|
||||||
import funkin.audio.waveform.WaveformSprite;
|
import funkin.audio.waveform.WaveformSprite;
|
||||||
|
@ -129,41 +129,41 @@ class ChartEditorAudioHandler
|
||||||
|
|
||||||
public static function switchToInstrumental(state:ChartEditorState, instId:String = '', playerId:String, opponentId:String):Bool
|
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);
|
var result:Bool = playInstrumental(state, instId);
|
||||||
if (!result) return false;
|
if (!result) return false;
|
||||||
|
|
||||||
var perfB:Float = TimerTools.start();
|
var perfB:Float = TimerUtil.start();
|
||||||
|
|
||||||
stopExistingVocals(state);
|
stopExistingVocals(state);
|
||||||
|
|
||||||
var perfC:Float = TimerTools.start();
|
var perfC:Float = TimerUtil.start();
|
||||||
|
|
||||||
result = playVocals(state, BF, playerId, instId);
|
result = playVocals(state, BF, playerId, instId);
|
||||||
|
|
||||||
var perfD:Float = TimerTools.start();
|
var perfD:Float = TimerUtil.start();
|
||||||
|
|
||||||
// if (!result) return false;
|
// if (!result) return false;
|
||||||
result = playVocals(state, DAD, opponentId, instId);
|
result = playVocals(state, DAD, opponentId, instId);
|
||||||
// if (!result) return false;
|
// if (!result) return false;
|
||||||
|
|
||||||
var perfE:Float = TimerTools.start();
|
var perfE:Float = TimerUtil.start();
|
||||||
|
|
||||||
state.hardRefreshOffsetsToolbox();
|
state.hardRefreshOffsetsToolbox();
|
||||||
|
|
||||||
var perfF:Float = TimerTools.start();
|
var perfF:Float = TimerUtil.start();
|
||||||
|
|
||||||
state.hardRefreshFreeplayToolbox();
|
state.hardRefreshFreeplayToolbox();
|
||||||
|
|
||||||
var perfG:Float = TimerTools.start();
|
var perfG:Float = TimerUtil.start();
|
||||||
|
|
||||||
trace('Switched to instrumental in ${TimerTools.seconds(perfA, perfB)}.');
|
trace('Switched to instrumental in ${TimerUtil.seconds(perfA, perfB)}.');
|
||||||
trace('Stopped existing vocals in ${TimerTools.seconds(perfB, perfC)}.');
|
trace('Stopped existing vocals in ${TimerUtil.seconds(perfB, perfC)}.');
|
||||||
trace('Played BF vocals in ${TimerTools.seconds(perfC, perfD)}.');
|
trace('Played BF vocals in ${TimerUtil.seconds(perfC, perfD)}.');
|
||||||
trace('Played DAD vocals in ${TimerTools.seconds(perfD, perfE)}.');
|
trace('Played DAD vocals in ${TimerUtil.seconds(perfD, perfE)}.');
|
||||||
trace('Hard refreshed offsets toolbox in ${TimerTools.seconds(perfE, perfF)}.');
|
trace('Hard refreshed offsets toolbox in ${TimerUtil.seconds(perfE, perfF)}.');
|
||||||
trace('Hard refreshed freeplay toolbox in ${TimerTools.seconds(perfF, perfG)}.');
|
trace('Hard refreshed freeplay toolbox in ${TimerUtil.seconds(perfF, perfG)}.');
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -175,9 +175,9 @@ class ChartEditorAudioHandler
|
||||||
{
|
{
|
||||||
if (instId == '') instId = 'default';
|
if (instId == '') instId = 'default';
|
||||||
var instTrackData:Null<Bytes> = state.audioInstTrackData.get(instId);
|
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);
|
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;
|
if (instTrack == null) return false;
|
||||||
|
|
||||||
stopExistingInstrumental(state);
|
stopExistingInstrumental(state);
|
||||||
|
@ -205,9 +205,9 @@ class ChartEditorAudioHandler
|
||||||
{
|
{
|
||||||
var trackId:String = '${charId}${instId == '' ? '' : '-${instId}'}';
|
var trackId:String = '${charId}${instId == '' ? '' : '-${instId}'}';
|
||||||
var vocalTrackData:Null<Bytes> = state.audioVocalTrackData.get(trackId);
|
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);
|
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();
|
if (state.audioVocalTrackGroup == null) state.audioVocalTrackGroup = new VoicesGroup();
|
||||||
|
|
||||||
|
@ -218,9 +218,9 @@ class ChartEditorAudioHandler
|
||||||
case BF:
|
case BF:
|
||||||
state.audioVocalTrackGroup.addPlayerVoice(vocalTrack);
|
state.audioVocalTrackGroup.addPlayerVoice(vocalTrack);
|
||||||
|
|
||||||
var perfStart:Float = TimerTools.start();
|
var perfStart:Float = TimerUtil.start();
|
||||||
var waveformData:Null<WaveformData> = vocalTrack.waveformData;
|
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)
|
if (waveformData != null)
|
||||||
{
|
{
|
||||||
|
@ -244,9 +244,9 @@ class ChartEditorAudioHandler
|
||||||
case DAD:
|
case DAD:
|
||||||
state.audioVocalTrackGroup.addOpponentVoice(vocalTrack);
|
state.audioVocalTrackGroup.addOpponentVoice(vocalTrack);
|
||||||
|
|
||||||
var perfStart:Float = TimerTools.start();
|
var perfStart:Float = TimerUtil.start();
|
||||||
var waveformData:Null<WaveformData> = vocalTrack.waveformData;
|
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)
|
if (waveformData != null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,7 +7,7 @@ import funkin.audio.waveform.WaveformDataParser;
|
||||||
import funkin.ui.debug.charting.commands.SetFreeplayPreviewCommand;
|
import funkin.ui.debug.charting.commands.SetFreeplayPreviewCommand;
|
||||||
import funkin.ui.haxeui.components.WaveformPlayer;
|
import funkin.ui.haxeui.components.WaveformPlayer;
|
||||||
import funkin.ui.freeplay.FreeplayState;
|
import funkin.ui.freeplay.FreeplayState;
|
||||||
import funkin.util.tools.TimerTools;
|
import funkin.util.TimerUtil;
|
||||||
import haxe.ui.backend.flixel.components.SpriteWrapper;
|
import haxe.ui.backend.flixel.components.SpriteWrapper;
|
||||||
import haxe.ui.components.Button;
|
import haxe.ui.components.Button;
|
||||||
import haxe.ui.components.HorizontalSlider;
|
import haxe.ui.components.HorizontalSlider;
|
||||||
|
@ -289,12 +289,12 @@ class ChartEditorFreeplayToolbox extends ChartEditorBaseToolbox
|
||||||
|
|
||||||
// Build player waveform.
|
// Build player waveform.
|
||||||
// waveformMusic.waveform.forceUpdate = true;
|
// waveformMusic.waveform.forceUpdate = true;
|
||||||
var perfStart:Float = TimerTools.start();
|
var perfStart:Float = TimerUtil.start();
|
||||||
var waveformData1 = playerVoice?.waveformData;
|
var waveformData1 = playerVoice?.waveformData;
|
||||||
var waveformData2 = opponentVoice?.waveformData ?? playerVoice?.waveformData; // this null check is for songs that only have 1 vocals file!
|
var waveformData2 = opponentVoice?.waveformData ?? playerVoice?.waveformData; // this null check is for songs that only have 1 vocals file!
|
||||||
var waveformData3 = chartEditorState.audioInstTrack.waveformData;
|
var waveformData3 = chartEditorState.audioInstTrack.waveformData;
|
||||||
var waveformData = waveformData3.merge(waveformData1).merge(waveformData2);
|
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;
|
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.
|
// Set the width and duration to render the full waveform, with the clipRect applied we only render a segment of it.
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package funkin.util.tools;
|
package funkin.util;
|
||||||
|
|
||||||
import funkin.util.tools.FloatTools;
|
import funkin.util.tools.FloatTools;
|
||||||
import haxe.Timer;
|
import haxe.Timer;
|
||||||
|
|
||||||
class TimerTools
|
class TimerUtil
|
||||||
{
|
{
|
||||||
public static function start():Float
|
public static function start():Float
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package funkin.util.plugins;
|
package funkin.util.plugins;
|
||||||
|
|
||||||
import flixel.FlxBasic;
|
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.
|
* 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)
|
if (FlxG.keys.justPressed.INSERT)
|
||||||
{
|
{
|
||||||
var perfStart:Float = TimerTools.start();
|
var perfStart:Float = TimerUtil.start();
|
||||||
funkin.util.MemoryUtil.collect(true);
|
funkin.util.MemoryUtil.collect(true);
|
||||||
trace('Memory GC took: ${TimerTools.seconds(perfStart)}');
|
trace('Memory GC took: ${TimerUtil.seconds(perfStart)}');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue