Re: AU Format Converter and mChannelsPerFrame
Re: AU Format Converter and mChannelsPerFrame
- Subject: Re: AU Format Converter and mChannelsPerFrame
- From: Doug Wyatt <email@hidden>
- Date: Wed, 8 Jun 2005 07:12:17 -0700
On Jun 8, 2005, at 2:45, Craig Bakalian wrote:
Hi,
I am uncertain about how the
convert.componentType = kAudioUnitType_FormatConverter;
convert.componentSubType = kAudioUnitSubType_AUConverter;
is converting stored audio data that has a
AudioStreamBasicDescription of mChannelsPerFrame = 1 to be
transformed into audio data that has an AudioStreamBasicDescription
of mChannelsPerFrame = 2. From my tests, it appears I can convert
audio data with 2 mChannelsPerFrame into 1, yet I cannot convert
from 1 to 2. No errors are thrown, the rendering happens, but the
sound is just coming out of one speaker after I attempted to
convert from 1 to 2. Is there something that needs to be done in
the callback of the render process? Is this conversion possible?
This AudioUnit simply wraps an AudioConverter to do its work.
So you need to understand how the AudioConverter handles mismatches
between input and output channel counts.
It uses a channel map which describes, for each output channel, which
input channel is the source. The default channel map is to route
input channel 0 to output channel 0, input 1 to output 1, etc.
This scheme does not provide for mixing, so when going 2->1 channels,
one will get dropped. If you want to mix the channels instead, I'd
suggest using an AUMatrixMixer.
When going from 1->2 channels, you can replicate the single input
channel to both output channels by setting the converter's channel
map via this property:
kAudioOutputUnitProperty_ChannelMap = 2002, //
this will also work with AUConverter
The property is an array of SInt32's, with its size as the number of
*output* channels. The array element for a given output channel says
which input channel is routed to that output. So to route input 0 to
outputs 0 and 1 (when there are 2 outputs), you'd simply set the
channel map to
SInt32 channelMap[2] = { 0, 0 };
(if you set a channel map element to -1, that means that the given
output channel will come from *no* input, i.e. it will be silent)
hth,
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