From 8695eeb66b0a0b26a023b4cfa978b424e88028ec Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Fri, 15 Dec 2023 13:11:24 -0500 Subject: [PATCH] v2.3.0: fixed track looping interfering with fade behaviour --- .../java/com/watabou/noosa/audio/Music.java | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/SPD-classes/src/main/java/com/watabou/noosa/audio/Music.java b/SPD-classes/src/main/java/com/watabou/noosa/audio/Music.java index c1adee2e2..8f25e410a 100644 --- a/SPD-classes/src/main/java/com/watabou/noosa/audio/Music.java +++ b/SPD-classes/src/main/java/com/watabou/noosa/audio/Music.java @@ -162,17 +162,20 @@ public enum Music { private com.badlogic.gdx.audio.Music.OnCompletionListener trackLooper = new com.badlogic.gdx.audio.Music.OnCompletionListener() { @Override public void onCompletion(com.badlogic.gdx.audio.Music music) { - //we do this in a separate thread to avoid graphics hitching while the music is prepared - if (!DeviceCompat.isDesktop()) { - new Thread() { - @Override - public void run() { - playNextTrack(music); - } - }.start(); - } else { - //don't use a separate thread on desktop, causes errors and makes no performance difference - playNextTrack(music); + //don't play the next track if we're currently in the middle of a fade + if (fadeTotal == -1f) { + //we do this in a separate thread to avoid graphics hitching while the music is prepared + if (!DeviceCompat.isDesktop()) { + new Thread() { + @Override + public void run() { + playNextTrack(music); + } + }.start(); + } else { + //don't use a separate thread on desktop, causes errors and makes no performance difference + playNextTrack(music); + } } } };