Follow-up to f98edf8: better checks for application restart.
- Fixes resource reloading when OsuGroupList is empty (i.e. if user has no beatmaps installed). - OsuGroupList is no longer initialized with a class instance; OsuGroupList.create() is called by OsuParser. - Also clear 'lastOsu' field in MusicController.reset(). Fixes theme song not playing on restart if it was the last track played (i.e. if no beatmaps installed). - Call MusicController.reset() last so that more garbage is collected. Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
@@ -83,9 +83,7 @@ public class MusicController {
|
||||
* Plays an audio file at the preview position.
|
||||
*/
|
||||
public static void play(final OsuFile osu, final boolean loop) {
|
||||
boolean play = (lastOsu == null || !osu.audioFilename.equals(lastOsu.audioFilename));
|
||||
lastOsu = osu;
|
||||
if (play) {
|
||||
if (lastOsu == null || !osu.audioFilename.equals(lastOsu.audioFilename)) {
|
||||
reset();
|
||||
System.gc();
|
||||
|
||||
@@ -114,6 +112,7 @@ public class MusicController {
|
||||
break;
|
||||
}
|
||||
}
|
||||
lastOsu = osu;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -335,6 +334,7 @@ public class MusicController {
|
||||
}
|
||||
|
||||
// reset state
|
||||
lastOsu = null;
|
||||
themePlaying = false;
|
||||
pauseTime = 0f;
|
||||
trackDimmed = false;
|
||||
|
||||
Reference in New Issue
Block a user