Java Sound On Ibooks Running Osx


Does anyone know if there is an issue with iBooks running JavaSound on OSX. I have a piece of code that plays a sound file and then, when the sound file is finished, opens up a recording stream. It runs fine on my Powerbook but crashes on iBooks. I get the following error message

Exception EXC_BAD_ACCESS (0x0001)

And when I trace it, the source is a thread with the code HAE_GetCaptureDeviceID.

I'm guessing it is something to do with the system not give back the audio resources after playing the audio cos when I change the code so that the audio doesn't play first it works fine. Unfortuately I need to audio to play.

I've tried it using AudioClip and with a proper audio player and the problem persists. I'm pretty sure that I am 'giving' back the resource (closing lines etc) but it doesn't work. The code for releasing the audio resources after playing is below.

if (pback != null) {
System.out.println("Got here 1");
System.out.println("Got here 2 " + line.isOpen());
line = null;
System.out.println("Got here 3");
audioInputStream = null;
System.out.println("Got here 4");
playbackInputStream = null;
System.out.println("Got here 5");

Any help would be greatly appreciated!