Added track previews to the downloads menu.

Currently uses the osu! server to load MP3 previews.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
Jeffrey Han
2015-03-19 15:58:50 -04:00
parent 7d5899ba7e
commit ec042159a8
8 changed files with 207 additions and 28 deletions

View File

@@ -54,7 +54,7 @@ public class MusicController {
private static OsuFile lastOsu;
/** The track duration. */
private static int duration = -1;
private static int duration = 0;
/** Thread for loading tracks. */
private static Thread trackLoader;
@@ -273,7 +273,7 @@ public class MusicController {
if (!trackExists() || lastOsu == null)
return -1;
if (duration == -1) {
if (duration == 0) {
if (lastOsu.audioFilename.getName().endsWith(".mp3")) {
try {
AudioFileFormat fileFormat = AudioSystem.getAudioFileFormat(lastOsu.audioFilename);
@@ -383,7 +383,7 @@ public class MusicController {
// reset state
lastOsu = null;
duration = -1;
duration = 0;
trackEnded = false;
themePlaying = false;
pauseTime = 0f;