EXC_BAD_ACCESS from AudioBuffer
- by jfalexvijay
I am trying to do the record using AudioUnit for iPhone app.
Changes: (start) I have added the following code
bufferList = (AudioBufferList *)malloc(sizeof(AudioBuffer));
bufferList-mNumberBuffers = 1;
bufferList-mBuffers[0].mNumberChannels = 2;
bufferList-mBuffers[0].mDataByteSize = 1024;
bufferList-mBuffers[0].mData = calloc(256, sizeof(uint32_t));
Changes: (end)
static OSStatus recordingCallback(void *inRefCon,
AudioUnitRenderActionFlags *ioActionFlags,
const AudioTimeStamp *inTimeStamp,
UInt32 inBusNumber,
UInt32 inNumberFrames,
AudioBufferList *ioData) {
OSStatus status;
status = AudioUnitRender(appdelegate-audioUnit,
ioActionFlags,
inTimeStamp,
inBusNumber,
inNumberFrames,
appdelegate-bufferList);
if(status != 0)
NSLog(@"AudioUnitRender status is %d", status);
SInt16* samples = (SInt16*)(ioData-mBuffers[0].mData);
.....
}
fixed: (I am getting OSStatus -50 error code)- Because I didn't initialize the bufferList.
I am EXC_BAD_ACCESS from AudioBuffer (ioData-mBuffers[0].mData).
I am not sure with this error. Please help me to resolve it.