v1.0.1: removed an unnecessary call to music.stop when disposing
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,10 +181,10 @@ public enum Music {
|
|||||||
player.setLooping(looping);
|
player.setLooping(looping);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user