[GREENFOOT-291] Catch potential sound error and display message instead of the stack trace
On linux, if some other application is using the sound card and a scenario with sound plays in Greenfoot, then the following error and stack trace occurs. It would perhaps be better to catch it and display a message.
Cannot get access to the sound card. If you have a sound card installed, check your system settings, and close down any other programs that might be using the sound card. javax.sound.sampled.LineUnavailableException: Audio Device Unavailable at com.sun.media.sound.HeadspaceMixer.nResume(Native Method) at com.sun.media.sound.HeadspaceMixer.implOpen(HeadspaceMixer.java:346) at com.sun.media.sound.AbstractMixer.open(AbstractMixer.java:286) at com.sun.media.sound.AbstractMixer.open(AbstractMixer.java:323) at com.sun.media.sound.MixerClip.open(MixerClip.java:162) at com.sun.media.sound.MixerClip.open(MixerClip.java:256) at greenfoot.sound.SoundClip.open(SoundClip.java:129) at greenfoot.sound.SoundClip.play(SoundClip.java:163) at greenfoot.Greenfoot.playSound(Greenfoot.java:150) at Bullet.(Bullet.java:24) at Rocket.fire(Rocket.java:71) at Rocket.act(Rocket.java:46) at greenfoot.core.Simulation.actActor(Simulation.java:452) at greenfoot.core.Simulation.runOneLoop(Simulation.java:415) at greenfoot.core.Simulation.run(Simulation.java:183)
Issue metadata
- Issue type: Task
- Priority: Low
- Fix versions: 2.1.0