1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-09 16:24:42 +00:00

more working audio offset in progress

This commit is contained in:
Cameron Taylor 2024-02-12 22:44:59 -05:00
parent e759f90147
commit 58077b4505
3 changed files with 11 additions and 3 deletions

View file

@ -214,11 +214,15 @@ class Conductor
/**
* An offset set by the user to compensate for input lag.
* No matter if you're using a local conductor or not, this always loads
* to/from the save file
*/
public var inputOffset(get, set):Int;
/**
* An offset set by the user to compensate for audio/visual lag
* No matter if you're using a local conductor or not, this always loads
* to/from the save file
*/
public var audioVisualOffset(get, set):Int;

View file

@ -67,7 +67,7 @@ class MusicBeatSubState extends FlxTransitionableSubState implements IEventHandl
// Display Conductor info in the watch window.
FlxG.watch.addQuick("musicTime", FlxG.sound.music?.time ?? 0.0);
Conductor.watchQuick();
Conductor.watchQuick(conductorInUse);
dispatchEvent(new UpdateScriptEvent(elapsed));
}

View file

@ -56,6 +56,7 @@ class LatencyState extends MusicBeatSubState
super.create();
localConductor = new Conductor();
conductorInUse = localConductor;
stateCamera = new FlxCamera(0, 0, FlxG.width, FlxG.height);
stateCamera.bgColor = FlxColor.BLACK;
@ -239,9 +240,11 @@ class LatencyState extends MusicBeatSubState
songVisFollowVideo.x = songPosToX(localConductor.songPosition - localConductor.inputOffset);
visualOffsetText.text = "Visual Offset: " + localConductor.audioVisualOffset + "ms";
visualOffsetText.text += "\nYou can press SPACE+Left/Right to change this value.";
visualOffsetText.text += "\n\nYou can press SPACE+Left/Right to change this value.";
visualOffsetText.text += "\n\nYou can hold SHIFT to step 1ms at a time";
offsetText.text = "INPUT Offset (Left/Right to change): " + localConductor.inputOffset + "ms";
offsetText.text += "\n\nYou can hold SHIFT to step 1ms at a time";
var avgOffsetInput:Float = 0;
@ -250,7 +253,7 @@ class LatencyState extends MusicBeatSubState
avgOffsetInput /= offsetsPerBeat.length;
offsetText.text += "\nEstimated average input offset needed: " + avgOffsetInput;
offsetText.text += "\n\nEstimated average input offset needed: " + avgOffsetInput;
var multiply:Int = 10;
@ -303,6 +306,7 @@ class LatencyState extends MusicBeatSubState
var getDiff:Float = localConductor.getTimeWithDiff(swagSong) - (closestBeat * (localConductor.stepLengthMs * 2));
// getDiff -= localConductor.inputOffset;
getDiff -= inputLatencyMs;
getDiff -= localConductor.audioVisualOffset;
// lil fix for end of song
if (closestBeat == 0 && getDiff >= localConductor.stepLengthMs * 2) getDiff -= swagSong.length;