shithub: aubio

Download patch

ref: 2525f817294de2ffbfb1423da0e7bf11ad8c787d
parent: 52d6145a0a9a9ab5cada373d290c86c350a7f547
parent: 19f222d84d42721aa650f5dc006088e83a9ba2c3
author: Paul Brossier <piem@piem.org>
date: Fri Mar 22 15:10:02 EDT 2013

Merge /Users/piem/projects/aubio/aubio into device

--- 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;
     }
   }
--- a/tests/src/io/test-source_seek.c
+++ b/tests/src/io/test-source_seek.c
@@ -22,6 +22,7 @@
   uint_t samplerate = 0;
   uint_t hop_size = 256;
   uint_t n_frames = 0, read = 0;
+  uint_t old_n_frames;
   if ( argc == 3 ) samplerate = atoi(argv[2]);
   if ( argc == 4 ) hop_size = atoi(argv[3]);
 
@@ -45,6 +46,8 @@
 
   aubio_source_seek (s, 0);
 
+  old_n_frames = n_frames;
+
   n_frames = 0;
   do {
     aubio_source_do(s, vec, &read);
@@ -59,5 +62,6 @@
 beach:
   del_fvec (vec);
 
+  assert ( n_frames == old_n_frames );
   return err;
 }