1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-14 19:05:15 +00:00

fix: fix the user song offsets being applied incorrectly

This commit is contained in:
Kolo 2024-10-03 13:28:01 +02:00 committed by Cameron Taylor
parent 39b1a42cfe
commit 410cfe972d
2 changed files with 26 additions and 3 deletions

View file

@ -413,7 +413,7 @@ class Conductor
}
// Take into account instrumental and file format song offsets.
songPos += applyOffsets ? (instrumentalOffset + formatOffset + audioVisualOffset) : 0;
songPos += applyOffsets ? (combinedOffset) : 0;
var oldMeasure:Float = this.currentMeasure;
var oldBeat:Float = this.currentBeat;

View file

@ -1457,11 +1457,34 @@ class PlayState extends MusicBeatSubState
if (FlxG.sound.music != null)
{
var correctSync:Float = Math.min(FlxG.sound.music.length, Math.max(0, Conductor.instance.songPosition - Conductor.instance.combinedOffset));
var playerVoicesError:Float = 0;
var opponentVoicesError:Float = 0;
if (!startingSong && (Math.abs(FlxG.sound.music.time - correctSync) > 5 || Math.abs(vocals.checkSyncError(correctSync)) > 5))
if (vocals != null)
{
@:privateAccess // todo: maybe make the groups public :thinking:
{
vocals.playerVoices.forEachAlive(function(voice:FunkinSound) {
var currentRawVoiceTime:Float = voice.time + vocals.playerVoicesOffset;
if (Math.abs(currentRawVoiceTime - correctSync) > Math.abs(playerVoicesError)) playerVoicesError = currentRawVoiceTime - correctSync;
});
vocals.opponentVoices.forEachAlive(function(voice:FunkinSound) {
var currentRawVoiceTime:Float = voice.time + vocals.opponentVoicesOffset;
if (Math.abs(currentRawVoiceTime - correctSync) > Math.abs(opponentVoicesError)) opponentVoicesError = currentRawVoiceTime - correctSync;
});
}
}
if (!startingSong
&& (Math.abs(FlxG.sound.music.time - correctSync) > 5 || Math.abs(playerVoicesError) > 5 || Math.abs(opponentVoicesError) > 5))
{
trace("VOCALS NEED RESYNC");
if (vocals != null) trace(vocals.checkSyncError(correctSync));
if (vocals != null)
{
trace(playerVoicesError);
trace(opponentVoicesError);
}
trace(FlxG.sound.music.time);
trace(correctSync);
resyncVocals();