Re: HALOutputUnit (Pt 2) confusion about surround channel mapping
Re: HALOutputUnit (Pt 2) confusion about surround channel mapping
- Subject: Re: HALOutputUnit (Pt 2) confusion about surround channel mapping
- From: Doug Wyatt <email@hidden>
- Date: Mon, 7 Jun 2004 15:19:57 -0700
On Jun 5, 2004, at 11:34, Jean-Alexis Montignies wrote:
Hello,
I have some questions with multi channel support/
I'm trying to fix vlc to make it work correctly with this feature from
panther.
Does AudioMidiSteup allows to define speaker configuration for several
formats, or is there can be only one type of speaker configuration
defined?
just one
i.e: can you define a configuration for quad output and one for 5.1
for a given device, or do you say that you have a 5.1 speaker
configuration?
the latter
How can you retrieve these informations? Especially the available
speaker configuration (or the one selected if only one is allowed)?
err = AudioDeviceGetPropertyInfo(mDevice, 0, isInput,
kAudioDevicePropertyPreferredChannelLayout, &theSize, NULL);
if (err == noErr) {
AudioChannelLayout *deviceLayout = static_cast<AudioChannelLayout
*>(malloc(theSize));
err = AudioDeviceGetProperty(mDevice, 0, isInput,
kAudioDevicePropertyPreferredChannelLayout,
&theSize, deviceLayout);
if (err == noErr) {
const AudioChannelLayout *layoutPair[2] = { clientLayout,
deviceLayout };
#if DEBUG
printf("\tmapping channel layouts: lX => lX\n",
layoutPair[0]->mChannelLayoutTag, layoutPair[1]->mChannelLayoutTag);
#endif
UInt32 channelMapSize;
err = AudioFormatGetPropertyInfo(kAudioFormatProperty_ChannelMap,
sizeof(layoutPair),
layoutPair, &channelMapSize);
if (err == noErr) {
UInt32 nch = channelMapSize/sizeof(SInt32);
channelMap = new SInt32[nch];
err = AudioFormatGetProperty(kAudioFormatProperty_ChannelMap,
sizeof(layoutPair),
layoutPair, &channelMapSize, channelMap);
if (err == noErr) {
*** do something with channelMap
}
delete[] channelMap;
}
}
free(deviceLayout);
}
Now if you have a known channel layout (it would in fact be easier to
use a tag, as channel layouts from vlc are standards) for your
generated stream, how would you give a map to the HALOutputUnit so it
uses the speaker configuration specified in AudioMidiSetup?
Actually the output unit does this already! If you are supplying it
mono or stereo, then by default it will map it to the device's default
stereo pair (and split mono to both left and right).
If you are supplying more than 2 channels, and the hardware has at
least that number of channels, then it will create the correct channel
map based on the channel layout you specified to the output unit and
the device's preferred channel layout. Just set the output unit's
channel layout (bus 0, input scope) after setting the stream format.
These are the default behaviors -- when you set a channel map, the
defaults are replaced.
Doug
As you can see, those multichannel concepts in coreaudio are not clear
for me :).
Thanks,
Jean-Alexis Montignies
http://www.sente.ch/
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.