Unable to record audio from second time onwards on Ubuntu 8.04.
843802May 15 2009 — edited May 26 2009Hi All,
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.implOpen(DirectAudioDevice.java:506)
at com.sun.media.sound.AbstractDataLine.open(AbstractDataLine.java:107)
at com.sun.media.sound.AbstractDataLine.open(AbstractDataLine.java:139)
at com.gtcocalcomp.screenrecorder.JRecorder.initiateAudioRecordingProcess(JRecorder.java:202)
at com.gtcocalcomp.screenrecorder.JRecorder.<init>(JRecorder.java:79)
at com.gtcocalcomp.interwrite.RecorderWindow.record(RecordPlayback.java:665)
at com.gtcocalcomp.interwrite.RecorderWindow$5.mouseReleased(RecordPlayback.java:597)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:232)
at java.awt.Component.processMouseEvent(Component.java:5488)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
at java.awt.Component.processEvent(Component.java:5253)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3955)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
at java.awt.Container.dispatchEventImpl(Container.java:2010)
at java.awt.Window.dispatchEventImpl(Window.java:1774)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.
.EventDispatchThread.run(EventDispatchThread.java:110)
If I close the application and restart, then 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?
Thanks in advance.