kAudioHardwarePropertyDevices + USB devices
kAudioHardwarePropertyDevices + USB devices
- Subject: kAudioHardwarePropertyDevices + USB devices
- From: Markus Handell <email@hidden>
- Date: Wed, 30 May 2001 14:51:17 +0200
Hi there,
I'm having problems with CoreAudio and using USB output devices. More
specifically, it's the device list that doesn't seem to be synchronized
with the
actual hardware devices connected to the computer.
Problem scenario:
1) I have the following devices connected:
a) Built-in audio controller
b) Philips USB Digital Speaker System (MA-150U)
c) Soundsticks
These are all reported by CoreAudio on application startup.
2) I unplug the Soundsticks. CoreAudio now correctly reports the device
list
change and only the two remaining devices are in the device list.
3) I reconnect the Soundsticks. CoreAudio reports of a device list
change, but
the Soundsticks doesn't appear when I request the list.
The same happens with the Philips speakers too. The strange thing is
that they all appear correctly when I restart my application!!!
The source code used to dump the list is as follows. Any suggestions???
void
ADHController::controlHappening(ControlRef control)
{
if (control == dump_)
{
UInt32 size;
int count;
Boolean writable;
TEVAL(noErr ==
AudioHardwareGetPropertyInfo(kAudioHardwarePropertyDevices,
&size, &writable));
printf(" Device dump: size %d bytes (=%d items)\n",
(int)size, (int)size/sizeof(AudioDeviceID));
AudioDeviceID V[size/sizeof(AudioDeviceID)];
TEVAL(noErr ==
AudioHardwareGetProperty(kAudioHardwarePropertyDevices,
&size, V));
count = size/sizeof(AudioDeviceID);
for (int i = 0; i < count; i ++)
{
TEVAL(noErr == AudioDeviceGetPropertyInfo(V[i], 0, FALSE,
kAudioDevicePropertyDeviceName, &size, &writable));
char devname[size + 1];
TEVAL(noErr == AudioDeviceGetProperty(V[i], 0, FALSE,
kAudioDevicePropertyDeviceName, &size, devname));
printf("#%d: %s\n", i + 1, devname);
}
}
fflush(stdout);
}