v1.0.1: removed an unnecessary call to music.stop when disposing
This commit is contained in:
parent
5569ab990c
commit
46635bbd9c
|
@ -26,6 +26,7 @@ import com.watabou.noosa.Game;
|
||||||
import com.watabou.utils.DeviceCompat;
|
import com.watabou.utils.DeviceCompat;
|
||||||
import com.watabou.utils.Random;
|
import com.watabou.utils.Random;
|
||||||
|
|
||||||
|
import java.awt.MediaTracker;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
|
@ -125,7 +126,7 @@ 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) {
|
||||||
if (trackList == null || trackList.length == 0 || player.isLooping()){
|
if (trackList == null || trackList.length == 0 || player.isLooping() || music != player){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,9 +182,9 @@ public enum Music {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO do we need to dispose every player? Maybe just stop them and keep an LRU cache of 2 or 3?
|
||||||
public synchronized void stop() {
|
public synchronized void stop() {
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
player.stop();
|
|
||||||
player.dispose();
|
player.dispose();
|
||||||
player = null;
|
player = null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user