AudioObjectGetPropertyDataSize returns 0 for kAudioHardwarePropertyDevices?
AudioObjectGetPropertyDataSize returns 0 for kAudioHardwarePropertyDevices?
- Subject: AudioObjectGetPropertyDataSize returns 0 for kAudioHardwarePropertyDevices?
- From: Troy Manchester via Coreaudio-api <email@hidden>
- Date: Thu, 17 Feb 2022 14:46:34 -0800
Hi,
We're using CoreAudio for sound in our app, and some of our users are
running into an issue where it seems like their Mac does not have any audio
devices. I'm trying to figure out why this is happening.
For one user in particular, the code I'm sharing below fails when they
switch to using their Mac's built-in speakers, but it otherwise succeeds
for their other devices (wired headphones, Apple Airpods). They're running
macOS 12.1.
For another user, they are using a more complicated setup (involving a USB
DAC/amplifier and a dozen or so aggregate devices). The code below fails
for them no matter which device they try. They're on macOS 12.2.
Here is the code we use to get the number of audio devices:
UInt32 dataSize;
AudioObjectPropertyAddress propertyAddress = {
kAudioHardwarePropertyDevices, kAudioObjectPropertyScopeGlobal,
kAudioObjectPropertyElementMaster };
OSStatus result = AudioObjectGetPropertyDataSize( kAudioObjectSystemObject,
&propertyAddress, 0, NULL, &dataSize );
if ( result != noErr ) {
return 0;
}
return dataSize / sizeof( AudioDeviceID );
The only lead we've come up with in testing this is to repeatedly kill
coreaudiod such that launchd will stop attempting to relaunch it. If we do
that, the code will return noErr and 0 for dataSize. Is it likely that our
users' CoreAudio daemon is not working properly?
Is there some set of cases where the above code might return 0 devices? I'm
going to add some logging to our code to print the result returned by
AudioObjectGetPropertyDataSize, but that will take a few weeks to make it
to our users and I'd like to attack this from all possible angles in the
meantime.
Thanks,
Troy
_______________________________________________
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