Technical Q&A QA1532

AudioConverter: How do I know when I am done?

Q:  How do I inform AudioConverter I am done processing data?

A: How do I inform AudioConverter I am done processing data?

By returning noErr and 0 packets of data, you are signaling to an Audio Converter object that you are out of data and at the logical end of the stream. Upon getting this message, the Audio Converter object will no longer call the input proc expecting to receive data. To get out of this state, you must call AudioConverterReset.

If you have no data to convert at this time but are not at the logical end of the stream, your input proc should return 0 packets of data along with any non-zero error code. This error will in turn be returned to you by AudioConverterFillComplexBuffer. The next time you call AudioConverterFillComplexBuffer, your input proc will get called again.

Audio Converter objects (of type AudioConverterRef) are built using the interfaces in the AudioConverter.h header file in the Audio Toolbox framework.

References



Document Revision History


DateNotes
2007-08-23

New document that describes how to correctly signal AudioConverter when a conversion is completed.