mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2025-11-26 14:16:00 +00:00
more working audio offset in progress
This commit is contained in:
parent
e759f90147
commit
58077b4505
|
|
@ -214,11 +214,15 @@ class Conductor
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An offset set by the user to compensate for input lag.
|
* 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;
|
public var inputOffset(get, set):Int;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An offset set by the user to compensate for audio/visual lag
|
* 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;
|
public var audioVisualOffset(get, set):Int;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ class MusicBeatSubState extends FlxTransitionableSubState implements IEventHandl
|
||||||
|
|
||||||
// Display Conductor info in the watch window.
|
// Display Conductor info in the watch window.
|
||||||
FlxG.watch.addQuick("musicTime", FlxG.sound.music?.time ?? 0.0);
|
FlxG.watch.addQuick("musicTime", FlxG.sound.music?.time ?? 0.0);
|
||||||
Conductor.watchQuick();
|
Conductor.watchQuick(conductorInUse);
|
||||||
|
|
||||||
dispatchEvent(new UpdateScriptEvent(elapsed));
|
dispatchEvent(new UpdateScriptEvent(elapsed));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,7 @@ class LatencyState extends MusicBeatSubState
|
||||||
super.create();
|
super.create();
|
||||||
|
|
||||||
localConductor = new Conductor();
|
localConductor = new Conductor();
|
||||||
|
conductorInUse = localConductor;
|
||||||
|
|
||||||
stateCamera = new FlxCamera(0, 0, FlxG.width, FlxG.height);
|
stateCamera = new FlxCamera(0, 0, FlxG.width, FlxG.height);
|
||||||
stateCamera.bgColor = FlxColor.BLACK;
|
stateCamera.bgColor = FlxColor.BLACK;
|
||||||
|
|
@ -239,9 +240,11 @@ class LatencyState extends MusicBeatSubState
|
||||||
songVisFollowVideo.x = songPosToX(localConductor.songPosition - localConductor.inputOffset);
|
songVisFollowVideo.x = songPosToX(localConductor.songPosition - localConductor.inputOffset);
|
||||||
|
|
||||||
visualOffsetText.text = "Visual Offset: " + localConductor.audioVisualOffset + "ms";
|
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 = "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;
|
var avgOffsetInput:Float = 0;
|
||||||
|
|
||||||
|
|
@ -250,7 +253,7 @@ class LatencyState extends MusicBeatSubState
|
||||||
|
|
||||||
avgOffsetInput /= offsetsPerBeat.length;
|
avgOffsetInput /= offsetsPerBeat.length;
|
||||||
|
|
||||||
offsetText.text += "\nEstimated average input offset needed: " + avgOffsetInput;
|
offsetText.text += "\n\nEstimated average input offset needed: " + avgOffsetInput;
|
||||||
|
|
||||||
var multiply:Int = 10;
|
var multiply:Int = 10;
|
||||||
|
|
||||||
|
|
@ -303,6 +306,7 @@ class LatencyState extends MusicBeatSubState
|
||||||
var getDiff:Float = localConductor.getTimeWithDiff(swagSong) - (closestBeat * (localConductor.stepLengthMs * 2));
|
var getDiff:Float = localConductor.getTimeWithDiff(swagSong) - (closestBeat * (localConductor.stepLengthMs * 2));
|
||||||
// getDiff -= localConductor.inputOffset;
|
// getDiff -= localConductor.inputOffset;
|
||||||
getDiff -= inputLatencyMs;
|
getDiff -= inputLatencyMs;
|
||||||
|
getDiff -= localConductor.audioVisualOffset;
|
||||||
|
|
||||||
// lil fix for end of song
|
// lil fix for end of song
|
||||||
if (closestBeat == 0 && getDiff >= localConductor.stepLengthMs * 2) getDiff -= swagSong.length;
|
if (closestBeat == 0 && getDiff >= localConductor.stepLengthMs * 2) getDiff -= swagSong.length;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue