#include <CoreFoundation/CoreFoundation.h>
// ExtAudioFileRef, AudioStreamBasicDescription, AudioBufferList, ...
#include <AudioToolbox/AudioToolbox.h>
+#include "aubio_priv.h"
int createAubioBufferList(AudioBufferList *bufferList, int channels, int segmentSize);
void freeAudioBufferList(AudioBufferList *bufferList);
int createAubioBufferList(AudioBufferList * bufferList, int channels, int segmentSize) {
bufferList->mNumberBuffers = 1;
bufferList->mBuffers[0].mNumberChannels = channels;
- bufferList->mBuffers[0].mData = (short *)malloc(segmentSize * sizeof(short));
+ bufferList->mBuffers[0].mData = AUBIO_ARRAY(short, segmentSize);
bufferList->mBuffers[0].mDataByteSize = segmentSize * sizeof(short);
return 0;
}
if (!bufferList) return;
for (i = 0; i < bufferList->mNumberBuffers; i++) {
if (bufferList->mBuffers[i].mData) {
- free (bufferList->mBuffers[i].mData);
+ AUBIO_FREE(bufferList->mBuffers[i].mData);
bufferList->mBuffers[i].mData = NULL;
}
}