Re: Getting an AudioDeviceID from device unique identifier (UID)
Re: Getting an AudioDeviceID from device unique identifier (UID)
- Subject: Re: Getting an AudioDeviceID from device unique identifier (UID)
- From: "B.J. Buchalter" <email@hidden>
- Date: Wed, 23 Apr 2003 15:01:32 -0400
on 4/23/03 2:18 PM, Jeff Moore at email@hidden wrote:
>
How could AudioHardwareGetProperty() return an error? You passed an
>
address, just not an address that pointed to a valid CFStringRef. There
>
really isn't a way to validate a random address like that. The best it
>
can do is check to see if you passed NULL.
>
>
I imagine that what you were doing was corrupting your heap, thus
>
setting up the conditions for a very hard to track down random crash
>
bug.
It didn't crash. It just was not able to find the actual device (remember,
he was passing the wrong value for the GUID -- not the AudioDeviceID, so
effectively he was not telling it the actual device GUID), but when it did
not find the device, it failed silently, and returned noErr instead of some
useful error code that could be used for debugging. I have seen this
behavior as well.
In my case I was setting up the AudioValueTranslation correctly, but I was
calling the AudioHardwareGetProperty function from a DeviceAddedCallback
that was running on its own pthread in response to an
IOServiceAddMatchingNotification. In this case, I had the same kind of
result -- AudioHardwareGetProperty returned noErr, but the returned
AudioDeviceID was not valid (it was not NULL, however). In my case, I think
the problem was that I was getting the notification before the HAL thread
was -- but I am not sure. In any case, there was an error (the device was
not found) but it was not reported. I solved my problem by deferring the
AudioHardwareGetProperty lookup until I really needed it from my main
thread, but it does seem odd...
Best regards,
B.J. Buchalter
Metric Halo
M/S 601 - Building 8
Castle Point Campus
Castle Point, NY 12511-0601 USA
tel +1 845 831-8600
fax +1 603 250-2451
If you haven't heard ChannelStrip yet, you don't know what you're missing!
Check out SpectraFoo, ChannelStrip and Mobile I/O at
http://www.mhlabs.com/
Download a 12 day demo from <
http://www.mhlabs.com/demo/>
_______________________________________________
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.