AudioBufferLists store their data in audioBufferList.mBuffers[i].mData .
mData is void* , and the actual type of values ββis determined by the output format you specify.
Example:
If you defined kAudioFormatFlagsCanonical ,
kAudioFormatLinearPCM ,
mBitsPerChannel = 32 and
mFramesPerPacket = 1
as your output format, the mData array contains values ββof type AudioSampleType (which is a Float32 typedef)
If you choose a different format, the array may contain SInt16 values ββor something else.
Therefore, you should know your type of output when you want to copy the contents of mData.
If you know the format, you can just create a c-array
dataCopy = calloc(dataSize, sizeof(Float32));
and memcpy audioBufferList.mBuffers [i] .mData into this.
If you want to use cocoa NSMutableArray, you will have to wrap the floats in an NSNumber object.
source share