shithub: aubio

Download patch

ref: 01e158db406826cfd9d667139a5643393bd5accb
parent: 1ebfa8c6f4dba41452dfc8a21ad5806f0b33c817
author: Paul Brossier <piem@piem.org>
date: Fri Jul 27 06:38:19 EDT 2012

src/io/source_apple_audio.{c,h}: if samplerate = 1, use actual source one

--- a/src/io/source_apple_audio.c
+++ b/src/io/source_apple_audio.c
@@ -89,6 +89,11 @@
       kExtAudioFileProperty_FileDataFormat, &propSize, &fileFormat);
   if (err) { AUBIO_ERROR("error in ExtAudioFileGetProperty, %d\n", (int)err); goto beach;}
 
+  if (s->samplerate == 1) {
+    clientFormat.mSampleRate = fileFormat.mSampleRate;
+    s->samplerate = fileFormat.mSampleRate;
+  }
+
   // set the client format description
   err = ExtAudioFileSetProperty(s->audioFile, kExtAudioFileProperty_ClientDataFormat,
       propSize, &clientFormat);
@@ -173,6 +178,10 @@
   freeAudioBufferList(&s->bufferList);
   AUBIO_FREE(s);
   return;
+}
+
+uint_t aubio_source_apple_audio_get_samplerate(aubio_source_apple_audio_t * s) {
+  return s->samplerate;
 }
 
 #endif /* __APPLE__ */
--- a/src/io/source_apple_audio.h
+++ b/src/io/source_apple_audio.h
@@ -24,6 +24,7 @@
 typedef struct _aubio_source_apple_audio_t aubio_source_apple_audio_t;
 aubio_source_apple_audio_t * new_aubio_source_apple_audio(char_t * path, uint_t samplerate, uint_t block_size);
 void aubio_source_apple_audio_do(aubio_source_apple_audio_t * s, fvec_t * read_to, uint_t * read);
+uint_t aubio_source_apple_audio_get_samplerate(aubio_source_apple_audio_t * s);
 void del_aubio_source_apple_audio(aubio_source_apple_audio_t * s);
 
 #endif /* _AUBIO_SOURCE_APPLE_AUDIO_H */