Fix sound playing
This commit is contained in:
parent
b972169341
commit
1727579f84
@ -34,7 +34,7 @@ public enum Sound {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void play() {
|
public void play() {
|
||||||
if (enabled) {
|
if (enabled && (soundClip != null)) {
|
||||||
soundClip.setFramePosition(0);
|
soundClip.setFramePosition(0);
|
||||||
soundClip.start();
|
soundClip.start();
|
||||||
}
|
}
|
||||||
@ -48,6 +48,9 @@ public enum Sound {
|
|||||||
clip = AudioSystem.getClip();
|
clip = AudioSystem.getClip();
|
||||||
clip.open(ais);
|
clip.open(ais);
|
||||||
}
|
}
|
||||||
|
} catch (IllegalArgumentException iae) {
|
||||||
|
Sound.setEnabled(false);
|
||||||
|
ExceptionHandler.handle(iae);
|
||||||
} catch (IOException | UnsupportedAudioFileException | LineUnavailableException ex) {
|
} catch (IOException | UnsupportedAudioFileException | LineUnavailableException ex) {
|
||||||
ExceptionHandler.handle(ex);
|
ExceptionHandler.handle(ex);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user