<Sound Dev> Opening multiple output lines

Thomas Fitzsimmons fitzsim at redhat.com
Fri Nov 23 16:22:38 PST 2007


Hi,

I'm testing a sound-using applet on Fedora 8.  Sun JDK 1.6 runs the applet 
correctly but OpenJDK does not.  The applet attempts to open two audio playback 
lines in succession, without closing the first before attempting to open the 
second.  The first open attempt succeeds but the second attempt fails with:

javax.sound.sampled.LineUnavailableException: line with format PCM_SIGNED 
44100.0 Hz, 16 bit, stereo, 4 bytes/frame, little-endian not supported.
         at 
com.sun.media.sound.DirectAudioDevice$DirectDL.implOpen(DirectAudioDevice.java:511)
         at com.sun.media.sound.AbstractDataLine.open(AbstractDataLine.java:124)
         at com.sun.media.sound.AbstractDataLine.open(AbstractDataLine.java:156)
         at PAPU.start(PAPU.java:198)
         at NES.enableSound(NES.java:390)
         at AppletGui.init(AppletGui.java:38)
         at sun.applet.AppletPanel.run(AppletPanel.java:435)
         at java.lang.Thread.run(Thread.java:674)

The exception message is misleading since the line format is supported.  The 
actual cause of the failure is in:

PLATFORM_API_LinuxOS_ALSA_PCMUtils.c:openPCMfromDeviceID

This call:

     ret = snd_pcm_open(handle, buffer,
                        isSource?SND_PCM_STREAM_PLAYBACK:SND_PCM_STREAM_CAPTURE,
                        SND_PCM_NONBLOCK);

returns the error corresponding to "Device or resource busy".

The attached test case demonstrates the failure.

Tom

-------------- next part --------------
A non-text attachment was scrubbed...
Name: AudioSystemGetLineTest.java
Type: text/x-java
Size: 747 bytes
Desc: not available
Url : http://mail.openjdk.java.net/pipermail/sound-dev/attachments/20071123/3375bb6c/attachment.bin 


More information about the sound-dev mailing list