Re: What exception to launch when AudioConverterDataSupplier fails?
Re: What exception to launch when AudioConverterDataSupplier fails?
- Subject: Re: What exception to launch when AudioConverterDataSupplier fails?
- From: Doug Wyatt <email@hidden>
- Date: Thu, 18 Dec 2003 11:31:31 -0800
We use C++ exceptions in the sample code and internally -- but (and
this applies equally to Java) one should never throw an exception
beyond a link-module boundary. In this case, your AudioConverter
callback should catch all exceptions and return an OSStatus. I'm sorry,
I don't know the particulars of the Java interface to the AC.
What you should do when there is no data available is to return any
non-zero value from your callback -- and no data (it would be ignored).
This tells the AudioConverter to stop everything it's doing, and return
whatever data has been produced so far (if any). It will also return
your same non-zero return code to the caller of
AudioConverterFillComplexBuffer (and related functions)
Doug
On Dec 17, 2003, at 13:55, Hugues Pisapia wrote:
Hi there,
I am implementing the com.apple.toolbox.AudioConverterDataSupplier
interface to feed an AudioConverter with data comming from a
java.io.InputStream.
When some Exception occurs while reading in this InputStream, I though
that throwing a 'new CAException(myExc.toString())' would make the
AudioConverter informed of my problem... However, it resulted with a
complete crash of the application :-(
I went into the documentation and found QA1317 talking about how to
inform the AC that no more data is available. But I did not find
anything about what to return... Can someone tell me about that? I
preferred not my application to crash when something like that occur.
Thanks,
Hugues
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.