From: Paul Brossier Date: Fri, 27 Jul 2012 16:38:19 +0000 (-0600) Subject: src/io/source_apple_audio.{c,h}: if samplerate = 1, use actual source one X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=01e158db406826cfd9d667139a5643393bd5accb;p=aubio.git src/io/source_apple_audio.{c,h}: if samplerate = 1, use actual source one --- diff --git a/src/io/source_apple_audio.c b/src/io/source_apple_audio.c index e5dede1c..d0bc6b54 100644 --- a/src/io/source_apple_audio.c +++ b/src/io/source_apple_audio.c @@ -89,6 +89,11 @@ aubio_source_apple_audio_t * new_aubio_source_apple_audio(char_t * path, uint_t 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); @@ -175,4 +180,8 @@ void del_aubio_source_apple_audio(aubio_source_apple_audio_t * s){ return; } +uint_t aubio_source_apple_audio_get_samplerate(aubio_source_apple_audio_t * s) { + return s->samplerate; +} + #endif /* __APPLE__ */ diff --git a/src/io/source_apple_audio.h b/src/io/source_apple_audio.h index 39e47dff..fe6e9cce 100644 --- 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 */