Re: How to save a reference to an Audio Device
Re: How to save a reference to an Audio Device
- Subject: Re: How to save a reference to an Audio Device
- From: Michael Thornburgh <email@hidden>
- Date: Fri, 1 Aug 2003 10:53:34 -0700
the audio device ID can be different for different processes, different
boots, and even within the same process after a removal and
reinsertion. it should absolutely not be used for this purpose.
you want to look at the kAudioDevicePropertyDeviceUID (for getting, if
you have the device ID) and kAudioHardwarePropertyDeviceForUID (for
finding the ID, given the UID) properties. if you're using
MTCoreAudio, you can use -[MTCoreAudioDevice deviceUID] and
+[MTCoreAudioDevice deviceWithUID:].
the device UID is supposed to be consistent between processes, reboots,
and additions/removals. in practice, i've found USB audio devices'
UIDs sometimes are different from boot to boot. the USB ID is encoded
in the UID of a USB audio device, and apparently there's some
non-determinism (at least on my system) when there's more than one USB
host adapter (i have built-in and a 4-bus PCI USB host adapter).
for added bonus robustness in saving a device selection, you should
save its UID _and_ its name. if looking up its UID fails, then choose
the one with the same name. use your favorite heuristic (like "the
first one" or "a random one") when there's more than one device with
the same name. :)
-mike
On Friday, August 1, 2003, at 02:04 AM, Malcolm Haylock wrote:
Hi everyone,
My application allows the user to select an output device and saves a
reference to that in the preferences. Is the correct way to store this
just to save the AudioDeviceID. ie. will this never change between
reboots or if other audio devices are added.
Thanks,
Malcolm Haylock
_______________________________________________
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.