Re: AudioConverter "insz" error related to sample rate?
Re: AudioConverter "insz" error related to sample rate?
- Subject: Re: AudioConverter "insz" error related to sample rate?
- From: Doug Wyatt <email@hidden>
- Date: Fri, 5 Nov 2004 09:09:26 -0800
On Nov 5, 2004, at 7:11, Christopher Ashworth wrote:
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?
kAudioConverterErr_InvalidInputSize ('insz') is returned when the
number of bytes (in the buffer list's buffers) and number of packets
returned by the input proc are inconsistent.
Doug
_______________________________________________
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