I'm developing my AudioServerPlugin almost same with AudioServerPlugin sample(NullAudio). What I'm trying to do is let my AudioServerPlugin is hidden by implementing kAudioDevicePropertyIsHidden
property as return 1, and my external Application set the kAudioDevicePropertyIsHidden
property to 0. Which allows me to control the show/hide status of my AudioServerPlugIn from my Application.
Here is what I've done,
static OSStatus MyPlugIn_IsDevicePropertySettable(AudioServerPlugInDriverRef inDriver, AudioObjectID inObjectID, pid_t inClientProcessID, const AudioObjectPropertyAddress* inAddress, Boolean* outIsSettable)
{
switch(inAddress->mSelector)
{
...
case kAudioDevicePropertyIsHidden:
*outIsSettable = true;
break;
}
...
}
And from my Application, I retrieved my PlugIn's Device ID by using kAudioHardwarePropertyTranslateUIDToDevice
. And call AudioObjectIsPropertySettable
with device ID.
CFStringRef devUID = CFSTR("MyPlugInDevice_UID");
AudioObjectPropertyAddress pa;
pa.mSelector = kAudioHardwarePropertyTranslateUIDToDevice;
pa.mScope = kAudioObjectPropertyScopeGlobal;
pa.mElement = kAudioObjectPropertyElementMain;
AudioDeviceID devID;
UInt32 size = sizeof(AudioDeviceID);
if(AudioObjectGetPropertyData (kAudioObjectSystemObject, &pa, sizeof(CFStringRef), &devUID, &size, &devID) == noErr)
{
pa.mSelector = kAudioDevicePropertyIsHidden;
pa.mScope = kAudioObjectPropertyScopeGlobal;
pa.mElement = kAudioObjectPropertyElementMain;
Boolean isSettable = false;
status = AudioObjectIsPropertySettable(devID, &pa, &isSettable);
}
But it keep returns 0 to `isSettable'.
On the other hands, if I made my PlugIn return false for every call of IsSettable, It returns true when the property is kAudioDevicePropertyIsNominalSampleRate
. It seems there is some kind of override from my implementation, but I can't find any documentation of it.