v2.3.0: fixed track looping interfering with fade behaviour

This commit is contained in:
Evan Debenham
2023-12-15 13:11:24 -05:00
parent 6c92861d99
commit 8695eeb66b

View File

@@ -162,17 +162,20 @@ public enum Music {
private com.badlogic.gdx.audio.Music.OnCompletionListener trackLooper = new com.badlogic.gdx.audio.Music.OnCompletionListener() { private com.badlogic.gdx.audio.Music.OnCompletionListener trackLooper = new com.badlogic.gdx.audio.Music.OnCompletionListener() {
@Override @Override
public void onCompletion(com.badlogic.gdx.audio.Music music) { 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 //don't play the next track if we're currently in the middle of a fade
if (!DeviceCompat.isDesktop()) { if (fadeTotal == -1f) {
new Thread() { //we do this in a separate thread to avoid graphics hitching while the music is prepared
@Override if (!DeviceCompat.isDesktop()) {
public void run() { new Thread() {
playNextTrack(music); @Override
} public void run() {
}.start(); playNextTrack(music);
} else { }
//don't use a separate thread on desktop, causes errors and makes no performance difference }.start();
playNextTrack(music); } else {
//don't use a separate thread on desktop, causes errors and makes no performance difference
playNextTrack(music);
}
} }
} }
}; };