Skip to content

Commit e9bd5a5

Browse files
authored
Improve Accurate VocalsResync (#833)
* Improve Accurate VocalsResync * Update PlayState.hx
1 parent 7434385 commit e9bd5a5

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

source/funkin/game/PlayState.hx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1255,12 +1255,13 @@ class PlayState extends MusicBeatState
12551255
}
12561256

12571257
@:dox(hide)
1258-
function resyncVocals():Void
1258+
inline function resyncVocals():Void
12591259
{
1260-
var time = Conductor.songPosition + Conductor.songOffset;
1261-
for (strumLine in strumLines.members) strumLine.vocals.play(true, time);
1262-
vocals.play(true, time);
1260+
final time = Conductor.songPosition + Conductor.songOffset;
1261+
12631262
if (!inst.playing) inst.play(true, time);
1263+
vocals.play(true, time);
1264+
for (strumLine in strumLines.members) strumLine.vocals.play(true, time);
12641265

12651266
gameAndCharsCall("onVocalsResync");
12661267
}
@@ -1419,13 +1420,12 @@ class PlayState extends MusicBeatState
14191420
else if (FlxG.sound.music != null && (__vocalSyncTimer -= elapsed) < 0) {
14201421
__vocalSyncTimer = 1;
14211422

1422-
var instTime = FlxG.sound.music.getActualTime();
1423-
var isOffsync:Bool = vocals.loaded && Math.abs(instTime - vocals.getActualTime()) > 100;
1424-
if (!isOffsync) {
1425-
for (strumLine in strumLines.members) {
1426-
if ((isOffsync = strumLine.vocals.loaded && Math.abs(instTime - strumLine.vocals.getActualTime()) > 100)) break;
1427-
}
1428-
}
1423+
final instTime = FlxG.sound.music.getActualTime();
1424+
var isOffsync:Bool = vocals.loaded && Math.abs(instTime - vocals.getActualTime()) > 6;
1425+
if (!isOffsync)
1426+
for (strumLine in strumLines.members)
1427+
if ((isOffsync = strumLine.vocals.loaded && Math.abs(instTime - strumLine.vocals.getActualTime()) > 6))
1428+
break;
14291429

14301430
if (isOffsync) resyncVocals();
14311431
}

0 commit comments

Comments
 (0)