From: Paul Brossier Date: Fri, 22 Mar 2013 23:32:58 +0000 (-0500) Subject: src/io/source_apple_audio.c: reset mDataByteSize in case of short read X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=987fb86c97aee37ed3a19ebeee659eec6a7e88e0;p=aubio.git src/io/source_apple_audio.c: reset mDataByteSize in case of short read --- diff --git a/src/io/source_apple_audio.c b/src/io/source_apple_audio.c index fc08b5c4..e2241879 100644 --- a/src/io/source_apple_audio.c +++ b/src/io/source_apple_audio.c @@ -237,6 +237,13 @@ void del_aubio_source_apple_audio(aubio_source_apple_audio_t * s){ } uint_t aubio_source_apple_audio_seek (aubio_source_apple_audio_t * s, uint_t pos) { + if (1) { + AudioBufferList *bufferList = &s->bufferList; + UInt32 samples = s->block_size * s->channels; + Float64 rateRatio = s->samplerate / s->source_samplerate; + uint_t segmentSize= (uint_t)(samples * rateRatio + .5); + bufferList->mBuffers[0].mDataByteSize = segmentSize * sizeof(short); + } SInt64 resampled_pos = (SInt64)ROUND( pos * s->source_samplerate * 1. / s->samplerate ); OSStatus err = ExtAudioFileSeek(s->audioFile, resampled_pos); if (err) AUBIO_ERROR("source_apple_audio: error in ExtAudioFileSeek (%d)\n", (int)err);