My game plays back sound via the usual method:
sdl.open();
sdl.start();
sdl.write(data, 0, data.length);
sdl.drain();
sdl.stop();
sdl.close();
And the user may cancel the playback (asynchronously):
sdl.stop();
This cancellation works nicely under Windows, but for one user running OSX 10.5.8 with Java 6 the program hangs. Threaddump shows the playback thread is inside drain(): com.sun.media.sound.MixerSourceLine.nDrain
. If the user doesn't interrupt the sound, it completes nicely and the application continues.
My questions are:
- Is this an OSX Java bug?
- Should I use
sdl.close()
instead of stop? - Any suggestions or experience on a workaround?
Edit: I found this bug report with similar effects, but the page says it is fixed.