diff --git a/src/itdelatrisu/opsu/Opsu.java b/src/itdelatrisu/opsu/Opsu.java index c8487dc4..8d2003ef 100644 --- a/src/itdelatrisu/opsu/Opsu.java +++ b/src/itdelatrisu/opsu/Opsu.java @@ -161,6 +161,7 @@ public class Opsu extends StateBasedGame { String[] icons = { "icon16.png", "icon32.png" }; app.setIcons(icons); app.setForceExit(true); + app.setUpdateOnlyWhenVisible(false); app.start(); diff --git a/src/itdelatrisu/opsu/audio/MusicController.java b/src/itdelatrisu/opsu/audio/MusicController.java index fc7e7cc8..6ae14843 100644 --- a/src/itdelatrisu/opsu/audio/MusicController.java +++ b/src/itdelatrisu/opsu/audio/MusicController.java @@ -70,8 +70,9 @@ public class MusicController { * @param osu the OsuFile to play * @param loop whether or not to loop the track * @param preview whether to start at the preview time (true) or beginning (false) + * @param reset plays at the preview time even if it has the same preview time as the last */ - public static void play(final OsuFile osu, final boolean loop, final boolean preview) { + public static void play(final OsuFile osu, final boolean loop, final boolean preview, final boolean reset) { // new track: load and play if (lastOsu == null || !osu.audioFilename.equals(lastOsu.audioFilename)) { reset(); @@ -94,7 +95,7 @@ public class MusicController { } // new track position: play at position - else if (osu.previewTime != lastOsu.previewTime) + else if (osu.previewTime != lastOsu.previewTime || reset) playAt(osu.previewTime, loop); lastOsu = osu; @@ -282,7 +283,7 @@ public class MusicController { public static void playThemeSong() { OsuFile osu = Options.getOsuTheme(); if (osu != null) { - play(osu, true, false); + play(osu, true, false, false); themePlaying = true; } } diff --git a/src/itdelatrisu/opsu/states/MainMenu.java b/src/itdelatrisu/opsu/states/MainMenu.java index 0a37ea5b..2aaa8619 100644 --- a/src/itdelatrisu/opsu/states/MainMenu.java +++ b/src/itdelatrisu/opsu/states/MainMenu.java @@ -377,6 +377,9 @@ public class MainMenu extends BasicGameState { logo.setX(container.getWidth() / 2); } } + + if (MusicController.trackEnded()) + nextTrack(); } @Override diff --git a/src/itdelatrisu/opsu/states/SongMenu.java b/src/itdelatrisu/opsu/states/SongMenu.java index d7c80d73..65340596 100644 --- a/src/itdelatrisu/opsu/states/SongMenu.java +++ b/src/itdelatrisu/opsu/states/SongMenu.java @@ -566,6 +566,10 @@ public class SongMenu extends BasicGameState { hoverOffset = 0f; hoverIndex = -1; } + if (MusicController.trackEnded()) { + OsuFile osu = focusNode.osuFiles.get(focusNode.osuFileIndex); + MusicController.play(osu, false, true, true); + } } @Override @@ -1163,7 +1167,7 @@ public class SongMenu extends BasicGameState { startNode = node; focusNode = OsuGroupList.get().getNode(node, osuFileIndex); OsuFile osu = focusNode.osuFiles.get(focusNode.osuFileIndex); - MusicController.play(osu, true, preview); + MusicController.play(osu, false, preview, false); Utils.loadGlyphs(osu); // load scores