Always get 'Unknown' for Hardware AudioChannelLabels
Always get 'Unknown' for Hardware AudioChannelLabels
- Subject: Always get 'Unknown' for Hardware AudioChannelLabels
- From: Jim McGowan <email@hidden>
- Date: Fri, 22 Aug 2014 13:45:45 +0800
Hi,
I’m trying to get the AudioChannelLabels for the input devices attached to the system. I’m iterating through the devices in the array returned from the SystemObject (kAudioObjectSystemObject)’s hardware devices property (kAudioHardwarePropertyDevices).
From each device I’m getting the AudioChannelLayout from it’s kAudioDevicePropertyPreferredChannelLayout property. Then I look at the AudioChannelLayout’s mChannelLayoutTag. Every device I’ve tested with so far returns the kAudioChannelLayoutTag_UseChannelDescriptions tag. In that case I iterate through the AudioChannelDescriptions and get each one’s AudioChannelLabel. However, every AudioChannelLabel for every stream on every device has a value of kAudioChannelLabel_Unknown (a.k.a UINT32_MAX).
This seems really unlikely, so I wanted to ask if I am going wrong somewhere. Below is the relevant code (error handling removed) and some output from my test. Any advice would be appreciated.
Thanks,
Jim
AudioObjectPropertyAddress inputChannelLayoutPropertyAddress;
inputChannelLayoutPropertyAddress.mSelector = kAudioDevicePropertyPreferredChannelLayout;
inputChannelLayoutPropertyAddress.mScope = kAudioDevicePropertyScopeInput;
inputChannelLayoutPropertyAddress.mElement = kAudioObjectPropertyElementMaster;
UInt32 audioChannelLayoutSize = 0;
status = AudioObjectGetPropertyDataSize(devicesArray[i], &inputChannelLayoutPropertyAddress, 0, NULL, &audioChannelLayoutSize);
AudioChannelLayout *channelLayout = malloc(audioChannelLayoutSize);
status = AudioObjectGetPropertyData(devicesArray[i], &inputChannelLayoutPropertyAddress, 0, NULL, &audioChannelLayoutSize, channelLayout);
AudioChannelLayoutTag tag = channelLayout->mChannelLayoutTag;
if (tag == kAudioChannelLayoutTag_UseChannelDescriptions)
{
UInt32 channelDescriptionsCount = channelLayout->mNumberChannelDescriptions;
for (UInt32 i =0; i < channelDescriptionsCount; i++)
{
AudioChannelDescription channelDescription = channelLayout->mChannelDescriptions[i];
AudioChannelLabel channelLabel = channelDescription.mChannelLabel;
printf("channel %d label: %d\n", i, channelLabel);
}
}
Built-in Microphone
Input streams (buffer count: 1)
Buffer 0 has 2 channels
channel 0 label: 4294967295
channel 1 label: 4294967295
Digidesign Mbox 2
Input streams (buffer count: 1)
Buffer 0 has 4 channels
channel 0 label: 4294967295
channel 1 label: 4294967295
channel 2 label: 4294967295
channel 3 label: 4294967295
Pro Tools Aggregate I/O
Input streams (buffer count: 1)
Buffer 0 has 2 channels
channel 0 label: 4294967295
channel 1 label: 4294967295
_______________________________________________
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