AudioConverter "insz" error related to sample rate?
AudioConverter "insz" error related to sample rate?
- Subject: AudioConverter "insz" error related to sample rate?
- From: Christopher Ashworth <email@hidden>
- Date: Fri, 5 Nov 2004 10:11:56 -0500
Hi,
I've googled through the archives but haven't seen quite this problem
so I'll go ahead and post it:
I am using an Audio Converter to help play files from disk to an output
device. The converter is created using the stream description of the
file as the input description and the stream description of an
MTCoreAudioDevice as the output description.
When playing a file, I have the playback IO proc reading from an
MTAudioBuffer, and a separate thread filling up that buffer. Inside
the thread that fills the buffer, I read a certain number of packets
from the audio file and convert them into an AudioBufferList by calling
AudioConverterFillComplexBuffer. (Just for reference, the
AudioBufferList is created via MTAudioBufferListNew). Then I write
that AudioBufferList into the MTAudioBuffer.
This works perfectly as long as the sample rate of my input file
matches the sample rate I am converting to. If the sample rate of the
file is different, the AudioConverterFillComplexBuffer function returns
an "insz" error.
I am sure there is enough room in the AudioBufferList to receive the
converted data. Also, if I artificially set the output stream
description to the same sample rate as the file when setting up the
converter, it converts fine (although of course the sound I hear is
either sped up or slowed down since the rate isn't correct for the
output device).
An earlier version of this code (before I added the use of the buffers)
converted the same files and played them back correctly. Is this
maybe related to converting into an AudioBufferList created by
MTAudioBufferListNew, rather than into the AudioBufferList I would
write into before, which was provided by the playback IO function?
Thanks very much for any hints,
Chris
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden