Re: Two same name audio device
Re: Two same name audio device
- Subject: Re: Two same name audio device
- From: Kris Daniel <email@hidden>
- Date: Thu, 10 Jun 2004 08:52:24 -0700
On Jun 10, 2004, at 4:56 AM, Timo Rantala wrote:
I have two similar usb audio device.
When I read "AudioDevicePropertyDeviceName",
I get two same name.
How can I know, which one is which one ?????
( is there any special ID or something )
Yes, there is. Here's a clip from
http://developer.apple.com/documentation/ReleaseNotes/Darwin/
IOAudioFamily.html that describes the IDs you want to look for:
--quote--
b" Added support for a global unique ID to be assigned to each
IOAudioEngine to allow each engine to be identified across reboots and
detach/re-attach operations.
b& New IOAudioEngine functions: getGlobalUniqueID and
getLocalUniqueID.
b& getGlobalUniqueID by default generates a unique ID string by
concatenating the class name, the location of audioDevice->getProvider
(which ls the location within the provider's bus) and the result of
getLocalUniqueID.
b& getLocalUniqueID needs to generate a scoped ID that is local to the
device. The default implementation returns an index based on the order
that the IOAudioEngine was added to the IOAudioDevice. If that isn't
sufficient to guarantee uniqueness for the engine, this should be
overridden to provide a better ID. A case where this is necessary is
the USB audio driver. Since a single driver/class may drive different
pieces of hardware that could be plugged into the same port (and hence
return the same location), it needs to provide another piece of
information that is unique to each device.
b" Added IOAudioEngine::setDescription to allow a custom description
to be set on each IOAudioEngine.
--quote--
If you need to get the ID from the IORegistry, find the IOAudioEngine's
entry and get the IOAudioEngineGlobalUniqueID property.
There is, however, a problem that you'll run into with Audio MIDI Setup
(version 2.0): if two (or more) devices provide the same name, (which
happens when identical devices are plugged in over USB), Audio MIDI
Setup will only display the name once in the drop-down menus for audio
device selection, even if the devices have different GlobalUniqueIDs.
This strikes me as a bug in Audio MIDI Setup. I've only seen it happen
with devices that I'm writing the driver for, so it's possible I'm
doing something wrong.
I'm overriding getGlobalUniqueID and creating a string that reads like
"<company> <product>: <serial number>". At the moment, I only have one
audio engine per device instance, so I didn't feel a need to override
the default implementation of getLocalUniqueID.
Thanks,
Kris Daniel
_______________________________________________
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.