ref: 19f222d84d42721aa650f5dc006088e83a9ba2c3
parent: 3286230f7713da2ad076b8a8e1106e0f3ab79790
author: Paul Brossier <piem@piem.org>
date: Fri Mar 22 15:09:53 EDT 2013
src/io/utils_apple_audio.c: use AUBIO_ARRAY / AUBIO_FREE
--- a/src/io/utils_apple_audio.c
+++ b/src/io/utils_apple_audio.c
@@ -4,6 +4,7 @@
#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);
@@ -12,7 +13,7 @@
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;
}
@@ -22,7 +23,7 @@
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;
}
}