Through the method (scanForDevices()
at juce_mac_CoreAudio.cpp
), audio devices are retrieved and used well.
But could you please improve the way I can find hidden audio devices?
According to the investigation, hidden audio devices can only be discovered by knowing their UID and using kAudioHardwarePropertyDeviceForUID
.
So, I’m using the code below at scanForDevices()
.
CFStringRef uid = CFSTR("HIDDEN_AUDIO_DRIVER_UID");
UInt32 uidSize = sizeof(uid);
pa.mSelector = kAudioHardwarePropertyTranslateUIDToDevice;
if (AudioObjectGetPropertyDataSize (kAudioObjectSystemObject, &pa, uidSize, &uid, &size) == noErr) {
HeapBlock<AudioDeviceID> devs;
devs.calloc (size, 1);
if (AudioObjectGetPropertyData (kAudioObjectSystemObject, &pa, uidSize, &uid, &size, devs) == noErr) {
char name[1024];
size = sizeof (name);
pa.mSelector = kAudioDevicePropertyDeviceName;
if (AudioObjectGetPropertyData (devs[0], &pa, 0, nullptr, &size, name) == noErr) {
auto nameString = String::fromUTF8 (name, (int) strlen (name));
auto numIns = getNumChannels (devs[0], true);
auto numOuts = getNumChannels (devs[0], false);
if (numIns > 0)
{
inputDeviceNames.add (nameString);
inputIds.add (devs[0]);
}
if (numOuts > 0)
{
outputDeviceNames.add (nameString);
outputIds.add (devs[0]);
}
}
}
}
I don’t know what other platforms are like, but it would be nice to have these features(scan hidden devices).
Do you have any plans to make them?
Thanks!