re: How to get the lists of connected Audio Devices
re: How to get the lists of connected Audio Devices
- Subject: re: How to get the lists of connected Audio Devices
- From: George Warner <email@hidden>
- Date: Mon, 13 Jun 2005 16:54:13 -0700
On Sun, 12 Jun 2005 18:49:09 -0400, Felipe Baytelman <email@hidden>
wrote:
> Hi everyone:
> I'm trying to get the list of connected audio output devices,
> but I can only get:
> Apple: AudioDeviceOutput
> Apple: DefaultOutputUnit
> Apple: GenericOutput
> Apple: SystemOutputUnit
>
> when what I really want to get is:
> Built-in Audio
> ... [other audio devices]
> just like AU Lab "Audio Device" menu when you ask for a new document.
>
> I remember I had this options some time ago, but now, I reviewed the
> complete list of components:
> desc.componentFlags = 0;
> desc.componentFlagsMask = 0;
> desc.componentSubType = 0;
> desc.componentManufacturer = 0;
>
> This gives me a HUGE collection of components, but no one is "Built-
> In Audio" nor "USB Audio Device".
>
An audio device is not a component. You will need to do something like this
to get the list of audio devices:
AudioHardwareGetPropertyInfo(kAudioHardwarePropertyDevices, &theSize,
NULL);
theNumberDevices = theSize / sizeof(AudioDeviceID);
theDeviceList = (AudioDeviceID*) malloc(theNumberDevices *
sizeof(AudioDeviceID));
Then use the AudioDevice APIs to get the Data source: (this lets you know
the difference between a mic & built-in audio speakers)
err = AudioDeviceGetProperty(mInputDevice.mID,
0,
TRUE,
kAudioDevicePropertyDataSource,
&size,
&inID);
checkErr(err);
CFStringRef theAnswer;
AudioValueTranslation theTranslation = { &inID, sizeof(UInt32),
&theAnswer, sizeof(CFStringRef) };
size = sizeof(AudioValueTranslation);
err = AudioDeviceGetProperty(mInputDevice.mID,
0,
TRUE,
kAudioDevicePropertyDataSourceNameForIDCFString,
&size,
&theTranslation)
--
Enjoy,
George Warner,
Schizophrenic Optimization Scientist
Apple Developer Technical Support (DTS)
_______________________________________________
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