diff --git a/source/funkin/Conductor.hx b/source/funkin/Conductor.hx index ff72b1e125..803b9e1b36 100644 --- a/source/funkin/Conductor.hx +++ b/source/funkin/Conductor.hx @@ -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; diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index 14b9429d76..d28ae6535a 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -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();