Re: What kind of loop to use?
Re: What kind of loop to use?
- Subject: Re: What kind of loop to use?
- From: Robert Grant <email@hidden>
- Date: Fri, 17 Sep 2004 22:05:01 -0400
Hi Alexander,
I just happened to look at this code again myself today (I wrote the
initial article - lifting relevant bits from my own code) and spotted
that undocumented curPos bit too!
curPos is the current sample position in the AIFF file. You start from
0 and increment based on the number of samples returned in the
converted buffer.
As far as ending the loop well you can just set that flag when you want
recording to stop. The conversion will stop when it finishes converting
the current buffer.
I'll update the example with this info too.
Hope that helps,
Robert.
On Sep 17, 2004, at 9:02 PM, Alexander Dvorak wrote:
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
while (!done)
// see this Apple page for info on indicating the
// end of the data: http://developer.apple.com/qa/qa2001/qa1317.html
{
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
} _______________________________________________
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
_______________________________________________
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