Cannot create processor after several audio records and playbacks of a file

Hello,

I have an application that allows the user to record and play back audio to a file. After recording and playing back several times to the same audio file, I eventually get an exception error thrown out when trying to record. After this happens, I'm no longer able to record to that file or another file (but audio playback works fine) unless I bring down the application and restart it.

How can I get around this problem without having to bring down the application and restarting it?

Here is a snippet of the code where the exception is occurring and not allowing the recording to start:

Processor processor=null;

try {

processor = Manager.createProcessor(di.getLocator());

processor.addControllerListener(listener);

} catch (Exception e) {

e.printStackTrace();

Log.dbg("!!!error cannot create processor");

}

And, here's the error exception:

javax.media.NoProcessorException: Error instantiating class: com.sun.media.protocol.javasound.DataSource : java.io.IOException: Line is already open with format PCM_SIGNED, 44100.0 Hz, 16 bit, stereo, little-endian, audio data and bufferSize 22048

at javax.media.Manager.createProcessorForContent(Manager.java:1538)

at javax.media.Manager.createProcessor(Manager.java:623)

at com.ibm.voicetools.audio.Recorder.<init>(Recorder.java:59)

at com.ibm.voicetools.audio.SWTAudioRecorder.record(SWTAudioRecorder.java:384)

at com.ibm.voicetools.audio.SWTAudioRecorder.access$13(SWTAudioRecorder.java:378)

at com.ibm.voicetools.audio.SWTAudioRecorder$5.widgetSelected(SWTAudioRecorder.java:161)

at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:83)

at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java(Compiled Code))

at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:622)

at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java(Compiled Code))

at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java(Compiled Code))

at com.ibm.voicetools.audio.SWTAudioRecorder.closeWindow(SWTAudioRecorder.java(Compiled Code))h

at com.ibm.voicetools.audio.SWTAudioRecorder.open(SWTAudioRecorder.java:330)

at com.ibm.voicetools.audio.AudioCreationWizard.performFinish(AudioCreationWizard.java:105)

at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:572)

at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:313)

at org.eclipse.jface.dialogs.Dialog$1.widgetSelected(Dialog.java:211)

at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:83)

at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java(Compiled Code))

at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:622)

at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java(Compiled Code))

at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java(Compiled Code))

at org.eclipse.jface.window.Window.runEventLoop(Window.java(Compiled Code))

at org.eclipse.jface.window.Window.open(Window.java:517)

at org.eclipse.ui.internal.NewWizardShortcutAction.run(NewWizardShortcutAction.java:82)

at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:408)

at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent(ActionContributionItem.java:362)

at org.eclipse.jface.action.ActionContributionItem.access$0(ActionContributionItem.java:353)

at org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent(ActionContributionItem.java:47)

at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java(Compiled Code))

at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:622)

at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java(Compiled Code))

at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java(Compiled Code))

at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:639)

at org.eclipse.ui.internal.Workbench.run(Workbench.java:622)

at org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoader.java:815)

at org.eclipse.core.boot.BootLoader.run(BootLoader.java:285)

at java.lang.reflect.Method.invoke(Native Method)

at org.eclipse.core.launcher.Main.basicRun(Main.java:119)

at org.eclipse.core.launcher.Main.run(Main.java:401)

at org.eclipse.core.launcher.UIMain.main(UIMain.java:52)

Thanks for your help.

-Miriam

[4620 byte] By [miriamf] at [2007-9-26 1:52:21]
# 1

the exception suggests that "Line is already open" which would imply to me that you have not properly closed the Processor (see close() method). i had problem where the number of open files on my system just kept increasing and this was due to not calling close().

Cheers,

Matt

mattdenner at 2007-6-29 3:01:57 > top of Java-index,Security,Cryptography...