don't just give up when LinePool can't be initialized

maybe fixes #2525
This commit is contained in:
Neil Gentleman 2016-11-01 18:52:42 -07:00
parent b5bb6dd0db
commit 5d55d299a2

View file

@ -50,7 +50,15 @@ public class AudioManager {
* AudioManager singleton. * AudioManager singleton.
*/ */
private static final AudioManager audioManager = new AudioManager(); private static final AudioManager audioManager = new AudioManager();
private final LinePool linePool = new LinePool(); private LinePool linePool;
public AudioManager() {
try {
linePool = new LinePool();
} catch (Exception e) {
log.warn("Failed to initialize AudioManager. No sounds will be played.", e);
}
}
public static AudioManager getManager() { public static AudioManager getManager() {
return audioManager; return audioManager;
@ -297,7 +305,9 @@ public class AudioManager {
} }
public void play(final MageClip mageClip) { public void play(final MageClip mageClip) {
linePool.playSound(mageClip); if (linePool != null) {
linePool.playSound(mageClip);
}
} }
} }