Selecting input mic for Mac Audio Queue Services?

安稳与你 提交于 2019-12-04 07:54:28
sbooth

To enumerate available input devices please see my answer to AudioObjectGetPropertyData to get a list of input devices.

Once you've determined the input device you'd like to use, you can set the kAudioQueueProperty_CurrentDevice property to the device's UID.

I fear, no, because AQ is hard-coded to use default input (to my best knowledge). AQ is fairly limited and only iOS gives more control via AutoSessions. However, you can use AUHAL to record from an arbitrary device:

http://developer.apple.com/library/mac/#technotes/tn2091/_index.html

You won't need listing 4 from above because you'll use the AudioDeviceID for the device you have chosen (presumably by getting the list of devices using AudioObjectGetPropertyDataSize and picking the one you want).

FWIW: if you decide that's too much, you can presumably still use AudioHardwareSetProperty to set kAudioHardwarePropertyDefaultInputDevice from your code - not what you wanted but certainly less work...

If you set up the Audio Queue to read from the default input device, then it will read from the mic that is selected as default in the System Preferences->Soubd->Input tab.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!