diff --git a/src/nmania/AudioController.java b/src/nmania/AudioController.java index e156f06..95ef19f 100644 --- a/src/nmania/AudioController.java +++ b/src/nmania/AudioController.java @@ -12,17 +12,17 @@ * @author Feodor0090 * */ -public final class AudioController { +public class AudioController { - public AudioController(Beatmap map) throws IOException, MediaException { - this(map.ToGlobalPath(map.audio)); + public AudioController(Beatmap map, boolean allowFallback) throws IOException, MediaException { + this(map.ToGlobalPath(map.audio), allowFallback); } - public AudioController(BeatmapSet set) throws IOException, MediaException { - this(set.ToGlobalPath(set.audio)); + public AudioController(BeatmapSet set, boolean allowFallback) throws IOException, MediaException { + this(set.ToGlobalPath(set.audio), allowFallback); } - public AudioController(String file) throws MediaException, IOException { + public AudioController(String file, boolean allowFallback) throws MediaException, IOException { Player p = TryInit(file, null); if (p == null) p = TryInit(file, "mp3"); @@ -32,7 +32,7 @@ public AudioController(String file) throws MediaException, IOException { p = TryInit(file, "amr"); if (p == null) p = TryInit(file, "wav"); - if (p == null) + if (p == null && !allowFallback) throw new IOException("Could not load any files on this MRL"); player = p; offset = Settings.gameplayOffset; @@ -65,8 +65,7 @@ private final Player TryInit(String mrl, String ext) throws MediaException { p.prefetch(); return p; } catch (MediaException e) { - if (e.toString().indexOf("not") != -1 && e.toString().indexOf("allowed") != -1) - throw e; + e.printStackTrace(); return null; } catch (IOException e) { return null; diff --git a/src/nmania/Player.java b/src/nmania/Player.java index a0d0db0..0120307 100644 --- a/src/nmania/Player.java +++ b/src/nmania/Player.java @@ -56,7 +56,7 @@ public Player(Beatmap map, PlayerBootstrapData opts, Skin s, ILogger log, Displa // step 2: loading music log.log("Loading music"); - track = new AudioController(map); + track = new AudioController(map, true); Thread.sleep(1); // step 3: setup difficulty diff --git a/src/nmania/ui/ng/NmaniaDisplay.java b/src/nmania/ui/ng/NmaniaDisplay.java index 21a6455..ca3563e 100644 --- a/src/nmania/ui/ng/NmaniaDisplay.java +++ b/src/nmania/ui/ng/NmaniaDisplay.java @@ -687,7 +687,7 @@ public void SetAudio(BeatmapSet set) { } try { GL.Log("(ui) Loading new music..."); - music = new AudioController(set); + music = new AudioController(set, false); music.Loop(); music.Play(); music.SetTimingData(set.timings);