mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 19:41:59 -08:00
don't just give up when LinePool can't be initialized
maybe fixes #2525
This commit is contained in:
parent
b5bb6dd0db
commit
5d55d299a2
1 changed files with 12 additions and 2 deletions
|
|
@ -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) {
|
||||||
|
if (linePool != null) {
|
||||||
linePool.playSound(mageClip);
|
linePool.playSound(mageClip);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue