Re: AudioConverterConvertBuffer() and interleaved data
Re: AudioConverterConvertBuffer() and interleaved data
- Subject: Re: AudioConverterConvertBuffer() and interleaved data
- From: Doug Wyatt <email@hidden>
- Date: Thu, 15 Sep 2005 11:59:14 -0700
Guillermo,
When working with a deinterleaved format, you have to use
AudioConverterFillComplexBuffer, since that's the only function in
the AudioConverter API that works with AudioBufferList's.
The 'fmt?' error is probably due to an easy-to-make mistake when
constructing a non-interleaved stream description: when that flag is
set, the mBytesPerFrame and mBytesPerPacket must indicate what will
be found in ONE of the non-interleaved buffers -- e.g. for 24-bit
integers, these fields would be 3.
Doug
On Sep 15, 2005, at 4:52, Guillermo Lapresta wrote:
Dear all,
I'm trying to convert the float, interleaved data from an stereo
audio unit to a uninterleaved, signed PCM format for writing out an
AIFF file. That is, I have an AudioBufferList with two data
pointers, mBuffers[0].mData and mBuffers[1].mData.
My question is how can I supply these buffers to
AudioConverterConvertBuffer(), since it needs a single pointer and
I have two. From API:
extern OSStatus AudioConverterConvertBuffer(
AudioConverterRef inAudioConverter,
UInt32 inInputDataSize,
const void*inInputData,
UInt32*ioOutputDataSize,
void*outOutputData);
inInputDataSize must be (mBuffers[x].mDataByteSize *
mNumberBuffers), otherwise the call returns an insz error. It seems
right. But, which pointer should I pass as inInputData? If I put
mBuffers[0].mData, only first channel is processed, and the same if
I do with mBuffers[1].mData. I have no idea of what's the correct
answer, could anyone give me a pointer to the right direction?
I tried also to uninterleave it manually to a buffer, but then,
setting the AudioConverter's input description turning on the flag
kAudioFormatFlagIsNonInterleaved, it complains with a 'fmt?' error.
Thanks in advance, and sorry if this is a really stupid question.
I'm a newbie with this.
--
Doug Wyatt
Core Audio, Apple
_______________________________________________
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