Re: reading audiofile into floatbuffer
Re: reading audiofile into floatbuffer
- Subject: Re: reading audiofile into floatbuffer
- From: Wesley Griffin <email@hidden>
- Date: Fri, 16 Jan 2004 16:12:49 -0500
On Jan 16, 2004, at 3:07 PM, stiwi kirch wrote:
floatBuffer.mBuffers[0].mData = malloc(?); // how can i calculate
the
memSize of one buffer?
This can be as large as you want. A 4K buffer would probably be good.
Thats exactly the part i don't understand! :( If i allocate a 4k
buffer then it can only be used as a temp buffer for the
AudioConverter to fill in 4k chunks of converted data. So i have to
call AudioConverterFillComplexBuffer repeatedly until all the data is
convert. AudioConverterFillComplexBuffer is using the same buffer over
and over again. Right? But i need the converted data to be in one or
two
Here's what I'm doing.
mBuffer is an AUBufferList which I'm using instead of a straight
AudioBufferList struct.
Call AudioFileGetProperty for kAudioFilePropertyAudioDataByteCount.
Allocate a buffer with the returned size.
Call AudioFileReadPackets passing the newly allocated buffer.
Call mBuffer.Allocate() passing the number of packets read by
AudioFileReadPackets.
Call mBuffer.PrepareBuffer()
Call AudioConverterFillComplexBuffer() passing
&(mSampleBuffer.GetBufferList()) for the AudioBufferList.
This is working for me. It might not be the "approved" method,
however...
_______________________________________________
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.