What kind of loop to use?
What kind of loop to use?
- Subject: What kind of loop to use?
- From: Alexander Dvorak <email@hidden>
- Date: Fri, 17 Sep 2004 21:02:13 -0400
Finally it's just a matter of iterating through the data and writing the converted packets to the file:
Dear All,
In the article http://www.mat.ucsb.edu:8000/CoreAudio/90, the author explains how to create an empty buffer (outputData). I understand that. He then offers this loop to fill the outputData buffer with some other data. It gets converted by the "converter" from float to aiff format. I understand how he set up the converter. Here is the unfinished code for the loop. I tried looking for how to finish this while loop. But even after looking at the suggested article, I cannot figure out how it works or how to test to see whether we are at the end of the input data. Also, I am confused about how to define the inputDataProc so that it takes info from the microphone. What is curPos? Do I increment it?
Very confused,
Alexander
<x-tad-smaller> while (!done)
// see this Apple page for info on indicating the
// end of the data: </x-tad-smaller><x-tad-smaller>http://developer.apple.com/qa/qa2001/qa1317.html</x-tad-smaller><x-tad-smaller>
{
status = AudioConverterFillComplexBuffer(converter,
InputDataProc, // see below
&myData, // any user data you want to supply to the input proc
&size, // the number of packets produced
&outputData, // the converted buffers
NULL); // not compressed so don't need a packet description
// we can use write packets because for uncompressed 1 packet = 1 frame
status = AudioFileWritePackets(audioFileID, // the ID from AudioFileCreate
FALSE, // don't need caching
size, // the amount of data returned
NULL, // no packet descriptions
curPos, // current sample location
&size, // actual data written
outputData.mBuffers[0].mData); // the buffer of converted audio
}</x-tad-smaller> _______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden