Re: AUHAL deinterleaved data format - how to handle it
Re: AUHAL deinterleaved data format - how to handle it
- Subject: Re: AUHAL deinterleaved data format - how to handle it
- From: Simon Liu <email@hidden>
- Date: Thu, 14 Oct 2004 23:26:12 +0100
Hi David,
Thanks.. I forgot that flag existed. For the built-in audio
controller, I buffer and copy the data and periodically, on a separate
thread, invokeAudioConverterConvertBuffer on the data e.g.
Channel 0 data | Channel 1 data |
500kb 500kb
The data is laid sequentially, based on channel, so it is not
interleaved. This should be the correct format the for the converter.
However, my resulting AIFF file is not okay - you can hear the audio
but it is jumpy and out of order - so it looks as though I may have
configured the format (below) incorrectly. Or perhaps I am supplying
data to the AudioConverter in the wrong fashion.
Any advice appreciated. Thanks.
--Simon
inputFormat.mSampleRate = 44100;
inputFormat.mFormatID = kAudioFormatLinearPCM;
inputFormat.mFormatFlags =
kLinearPCMFormatFlagIsBigEndian |
kLinearPCMFormatFlagIsPacked |
kLinearPCMFormatFlagIsNonInterleaved |
kLinearPCMFormatFlagIsFloat;
inputFormat.mBytesPerPacket = 4; //8;
inputFormat.mFramesPerPacket = 1;
inputFormat.mBytesPerFrame = 4; //8;
inputFormat.mChannelsPerFrame = 1; //2;
inputFormat.mBitsPerChannel = 32;
aiffFormat.mSampleRate = 44100;
aiffFormat.mFormatID = kAudioFormatLinearPCM;
aiffFormat.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger |
kLinearPCMFormatFlagIsPacked |
kLinearPCMFormatFlagIsBigEndian;
aiffFormat.mBytesPerPacket = 4;
aiffFormat.mFramesPerPacket = 1;
aiffFormat.mBytesPerFrame = 4;
aiffFormat.mChannelsPerFrame = 2;
aiffFormat.mBitsPerChannel = 16;
On Thu, 14 Oct 2004 14:25:05 -0400, David Duncan <email@hidden> wrote:
> On Oct 14, 2004, at 01:01 PM, Simon Liu wrote:
>
> > As stated in TN2091, an AUHAL's AudioBufferList points to
> > deinterleaved data. In my tests, for my built-in audio controller,
> > there are 2 buffers, with each buffer holding 1 channel worth of data.
> > This is only for HALOutput AUs, and not normal AUs right?
>
> v2 AUs by default all use deinterleaved formats, this is not restricted
> to the HAL Output AU.
>
> > - In my AUHAL render callback, I want to copy the data to a buffer,
> > which is periodically looked at by a thread which uses AudioConverter
> > with a AudioFile to write out an AIFF file. How can I interleave the
> > data efficiently, so I can use AudioConverter?
>
> You don't need to interleave the data for the Audio Converter, just
> configure your converter to accept de-interleaved audio and output
> interleaved.
>
> --
> Reality is what, when you stop believing in it, doesn't go away.
> Failure is not an option. It is a privilege reserved for those who try.
>
> David Duncan
>
>
_______________________________________________
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