Hi All,

I tried this problem at Java Forums and got response as it may be an OS issue, because the same application works fine on MAC and Windows OS.

I have developed an audio recording application. The application provides the facility to record, save and play the audio using javax.sound API any number of times. The application works fine on MAC and Windows Systems. But when I run the same application on Ubuntu 8.04, for the first time, it works fine and file is recorded and played successfully. If I try to record the second time, the following exception is thrown:

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.imp lOpen(DirectAudioDevice.java:506)
at com.sun.media.sound.AbstractDataLine.open(Abstract DataLine.java:107)
at com.sun.media.sound.AbstractDataLine.open(Abstract DataLine.java:139)
at com.gtcocalcomp.screenrecorder.JRecorder.initiateA udioRecordingProcess(JRecorder.java:202)
at com.gtcocalcomp.screenrecorder.JRecorder.<init>(JR ecorder.java:79)
at com.gtcocalcomp.interwrite.RecorderWindow.record(R ecordPlayback.java:665)
at com.gtcocalcomp.interwrite.RecorderWindow$5.mouseR eleased(RecordPlayback.java:597)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEven tMulticaster.java:232)
at java.awt.Component.processMouseEvent(Component.jav a:548
at javax.swing.JComponent.processMouseEvent(JComponen t.java:3126)
at java.awt.Component.processEvent(Component.java:525 3)
at java.awt.Container.processEvent(Container.java:196 6)
at java.awt.Component.dispatchEventImpl(Component.jav a:3955)
at java.awt.Container.dispatchEventImpl(Container.jav a:2024)
at java.awt.Component.dispatchEvent(Component.java:38 03)
at java.awt.LightweightDispatcher.retargetMouseEvent( Container.java:4212)
at java.awt.LightweightDispatcher.processMouseEvent(C ontainer.java:3892)
at java.awt.LightweightDispatcher.dispatchEvent(Conta iner.java:3822)
at java.awt.Container.dispatchEventImpl(Container.jav a:2010)
at java.awt.Window.dispatchEventImpl(Window.java:1774 )
at java.awt.Component.dispatchEvent(Component.java:38 03)
at java.awt.EventQueue.dispatchEvent(EventQueue.java: 463)
at java.awt.EventDispatchThread.pumpOneEventForHierar chy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarch y(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThre ad.java:110)

If I close the application and restart, again for the first time, it works fine and gives the above exception from there onwards.

I tried several options like, making all the objects involved in starting the audio recording process to null, then calling System.gc() and creating every object a fresh but no success.

Can anybody give me some idea/information/links to overcome this problem?


Or can anybody tell whether the audio input line on Ubuntu machines/any Linux OS is blocked once the application is started and no further lines can be opened till the current application is closed?

Thanks in advance.