2015-11-26 100 views

回答

0

這不能在用戶應用程序級別完成。這可能通過安裝OS X kext(內核擴展)或自定義音頻設備驅動程序來實現,該驅動程序需要sudo權限並可能需要重啓。

0

我認爲這可以使用kAudioDevicePropertyDeviceIsRunningSomewhere屬性進行檢查。

從頭部DOC:

A UInt32 where 1 means that the AudioDevice is running in at least one process on the system and 0 means that it isn't running at all.

僞-Y代碼:

bool isRunningSomewhere(AudioDeviceID deviceId) { 
    uint32 val; 
    uint32 size = sizeof(val); 
    AudioObjectPropertyAddress pa = { kAudioDevicePropertyDeviceIsRunningSomewhere, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster }; 
    AudioObjectGetPropertyData(deviceId, &pa, 0, NULL, &size, &val); 
    return val == 1; 
} 

這應該告訴你,如果正在使用的設備(即具有活動IOProc)。但不會告訴你IOProc是否只是發送沉默。

+0

非常感謝,今晚我會嘗試一下,回到你身邊。 – user2539621

相關問題