Re: setting up AudioUnit for interleaved format
Re: setting up AudioUnit for interleaved format
- Subject: Re: setting up AudioUnit for interleaved format
- From: William Stewart <email@hidden>
- Date: Tue, 3 May 2005 11:18:07 -0700
On 03/05/2005, at 3:09 AM, Elvio Magliocca wrote:
>William Stewart wrote:
The current SDK (in both Tiger and 1.3.4) establishes V2 audio
units. In fact we explicitly removed some code in the Tiger SDK
so this question would no longer arise.
Basically, the host is responsible for setting formats, not the
AU. The AU describes to the host what its capabilities are. As
Chris describes, the canonical format for Audio Units is a non-
interleaved format.
If you want to process data as interleaved, you will have to (and
can of course) interleave the de-interleaved data that you
receive from the host, process it, then de-interleave *back* to
the de-interleaved format that the host is asking you to produce.
The AudioConverter API could be used to do this interleave and
deinterleave
Why AU template create this code?
while (nSampleFrames-- > 0) {
Float32 inputSample = *sourceP;
sourceP += inNumChannels; // advance to next frame (e.g.
if stereo, we're advancing 2 samples);
// we're only processing one of
an arbitrary number of interleaved channels
inNumChannels (as I said before) is always 1 for an AU (in fact the
provision of this argument is only due to historical reasons and
serves NO PURPOSE for most AU's today - for clarity we should remove
this)
It seams that all channels are interleaved every time, not de-
interleaved like you say.
I've need to process each channel with different algorithm so I've
to de-interleave the channels,
but to do it I've to know interleaved format.
Ok
For example a 5.1 system can have these interleaved channels format:
- L R C LFE LS RS L R C LFE LS RS .....
or these interleaved channels format:
- L R LS RS C LFE L R LS RS C LFE .....
or more.
This is interleaved - as an AU you can be given this data in a de-
interleaved format. The AudioChannelLayout describes the order of
channels - there are two AU properties that are used to deal with
this situation... If you run the auval tool on the AUMatrixReverb I
think you'll get a sense of how this is published (have a look at the
format tests).
We generally encourage both AU and host developers to deal with
cannonical channel orderings for surround configurations - so if you
have a 5.1 stream, we'd *expect* an AU to deal with this as specifed
by the AudioUnit_5.1 channel order (these are all declared in
<CoreAudio/CoreAudioTypes.h>
Can I think that interleaved channels follow the host configuration?
You DO NOT GET interleaved channels as an AU. Aside from that I do
not understand your question...
Can I work, like in VST, directly with my channels?
For example, like this:
while (nSampleFrames-- > 0) {
Float32 in1 = *sourceP++;
Float32 in2 = *sourceP++;
Float32 in3 = *sourceP++;
Float32 in4 = *sourceP++;
Float32 in5 = *sourceP++;
.............
This is interleaved.
Deinterleaved data is the canonical format for AUs.
In your AU, you can internally interleave the channels if you want to
process interleaved data - but then you will also need to
deinterleave them to pass the data back out. That isn't a big deal
and should be fairly easy to accomplish. You should also remember
that the host sets your formats, not the AU.
Thank you
Elvio
Bill
--
mailto:email@hidden
tel: +1 408 974 4056
________________________________________________________________________
__
"Much human ingenuity has gone into finding the ultimate Before.
The current state of knowledge can be summarized thus:
In the beginning, there was nothing, which exploded" - Terry Pratchett
________________________________________________________________________
__
_______________________________________________
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