Re: Output Channel Selection Redux
Re: Output Channel Selection Redux
- Subject: Re: Output Channel Selection Redux
- From: William Stewart <email@hidden>
- Date: Tue, 24 Feb 2009 15:42:36 -0800
On Feb 24, 2009, at 2:38 PM, Bob Ingraham wrote:
Hey All,
Thanks for the help thus far!
But I am just hitting a brick wall here. I think I'm on the right
track with the SimpleSDK PlayFile example I've been modifying, but I
just can't past the channel select problem using
kAudioOutputUnitProperty_ChannelMap.
Any help would be most appreciated...
Here's how we use this property in AULab:
UInt32 numOutputChannels; // the number of channels of the device
OSStatus result;
SInt32 *channelMap = NULL;
ca_require_noerr (result = mOutputAU.NumberChannels
(kAudioUnitScope_Output, 0, numOutputChannels), home);
// this sets the channel map up so that all of the channels are
marked as unused
channelMap = new SInt32 [numOutputChannels];
for (unsigned int i = 0; i < numOutputChannels; ++i)
channelMap[i] = -1;
//OUR_NUMBER_OF_CHANNELS is the number of channels you are using
// for AULab, this is the number of output channels of your AULab
session document
inDeviceChannels is a OUR_NUMBER_OF_CHANNELS sized array
each entry in this array describe which channel of the device that
channel fo the document should go to
if the number is > than the number of device channels, we skip it
(this is the "unused" part of the AULab output channel config)
for (unsigned int i = 0; i < OUR_NUMBER_OF_CHANNELS ++i) {
SInt32 chan = inDeviceChannels[i];
if (chan >= 0 && UInt32(chan) < numOutputChannels)
channelMap[chan] = i;
}
// print it out
#if VERBOSE_DEVICE_CHANS
printf ("Passed in:\n[");
for (unsigned int i = 0; i < OUR_NUMBER_OF_CHANNELS; ++i)
printf ("%d, ", inDeviceChannels[i]);
printf ("]\n");
printf ("Setting Device Channels\n\t[");
for (unsigned int i = 0; i < numOutputChannels; ++i)
printf ("%d, ", channelMap[i]);
printf ("]\n");
#endif
// set it
ca_require_noerr (result = mOutputAU.SetProperty
(kAudioOutputUnitProperty_ChannelMap, kAudioUnitScope_Input, 0,
channelMap, (numOutputChannels * sizeof(SInt32))), home);
_______________________________________________
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