Re: AudioConverter and interleaving woes
Re: AudioConverter and interleaving woes
- Subject: Re: AudioConverter and interleaving woes
- From: Brad Ford <email@hidden>
- Date: Sun, 10 Oct 2004 13:13:38 -0700
The input and output buffers should be the same size, but when I use
AudioConverterGetProperty() to find the input buffer size for a given
output buffer size (flag
kAudioConverterPropertyCalculateInputBufferSize),
it tells me that the input buffer size should be 8 times the output
buffer
size. Therefore any call to AudioConvertBuffer will fail if I give it
the
same size buffers.
What is going on - is this an incorrect use for AudioConverters?
Malcom,
I think you need to think of buffer size in the context of an
AudioBufferList. When deinterleaving, the input format is 8-channel,
32-bit integer interleaved, in other words, you'd describe it in an
AudioBufferList as:
bl->mNumberBuffers = 1;
bl->mBuffers[0].mNumberChannels = 8;
bl->mBuffers[0].mDataByteSize = 32 (bits) * 8 (channels) * n (frames);
bl->mBuffers[0].mData = ptrToBigBuffer;
Whereas, on the output side, you have deinterleaved, meaning an audio
buffer list with 8 separate buffers, each one is 1/8th the size of your
input buffer list's single data buffer:
outBL->mNumberBuffers = 8;
outBL->mBuffers[0].mNumberChannels = 1;
outBL->mBuffers[0].mDataByteSize = 32 (bits) * 1 (channel) * n (frames);
outBL->mBuffers[0].mData = ptrToBufferForChannel1;
....etc (for 8 buffers)
The calculateInputBufferSize call is probably expecting that the number
of bytes you specify to be equal to the number of bytes you want in
each AudioBuffer. So the fact that it's giving you a number that is 8
times greater is correct.
-Brad Ford
QuickTime Engineering
_______________________________________________
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