How to avoid "no audio device" applet death
Posted on 2000-03-23
I have an applet that can play a sound in response to an external event.
My code is:
AudioClip clip = applet.getAudioClip( applet.getCodeBase(), "Ding.au" );
If 2 instance of the applet are running or some other program, such as my mail program, plays a sound, and the timing of these events causes the clips to interfere with each other, the applet writes an error message to the Java console:
"no audio device"
After this message has appeared the next, and every subsequent, clip.play() will block forever. The applet is hung.
This is totally un-acceptable, however I cannot find any way to determine that this has happened, nor is their any excpetion I could catch to allow my applet to recover?
Does anyone have a workaround? Is there an open bug on the sun Java Developer Connection website that I can vote for?