Skip to content

Commit 440fe49

Browse files
Update Mixer.hx
1 parent 9ab68f5 commit 440fe49

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/music/Mixer.hx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,10 @@ class Mixer {
151151
inline static public function updateSmoothMusicTime(deltaTime:Float, playfield:PlayField, window:Window):Void {
152152
if (isPlaying()) {
153153
var ogSongPos = playfield.songPosition + (deltaTime * speed);
154-
var rawPlaybackPosition = MiniAudio.getPlaybackPosition() + (playfield.latencyCompensation - Mixer.latency());
155-
if (rawPlaybackPosition < 40) {
156-
playfield.songPosition = ogSongPos;
154+
var latency = playfield.latencyCompensation - Mixer.latency();
155+
var rawPlaybackPosition = MiniAudio.getPlaybackPosition() + latency;
156+
if (playfield.songPosition - rawPlaybackPosition > 10) {
157+
playfield.songPosition = ogSongPos + latency;
157158
} else {
158159
playfield.songPosition += deltaTime * speed;
159160

0 commit comments

Comments
 (0)