const AudioBuffer *buffer;
buffer = &inInputData->mBuffers[0];
if (lastIndex + buffer->mDataByteSize> bufferSize)
// cancels recording
else
{
memcpy(soundBuffer + lastIndex, buffer->mData, buffer->mDataByteSize);
lastIndex += buffer->mDataByteSize;
}
soundBuffer is just defined as:
unsigned char *soundBuffer;
Is there an easy way to write this raw data to an AIFF file without messing with callbacks and devices? The documentation and sample code all show how to write a file from AudioBufferList *s in the device callback, but I don't want to put it out to disk unless the user presses a button to approve it, at which time I've got the data in memory (these are short sound recordings) already.
Any help or suggestions would be greatly appreciated.