【发布时间】:2012-07-05 15:48:27
【问题描述】:
是否有可能可靠地获得 Mac 内置输出的AudioDeviceID?我尝试使用kAudioHardwarePropertyDefaultOutputDevice 来获取当前选择的输出设备,但这可以是任何旧设备,具体取决于用户在系统偏好设置中选择的内容——我只想要内置扬声器的 ID。
AudioObjectPropertyAddress theAddress = { kAudioHardwarePropertyDefaultInputDevice,
kAudioObjectPropertyScopeGlobal,
kAudioObjectPropertyElementMaster };
verify_noerr (AudioObjectGetPropertyData(kAudioObjectSystemObject,
&theAddress,
0,
NULL,
&propsize,
&inputDevice));
目前我正在获取所有设备的列表并通过执行name == "Built-in Output" 检查设备的名称字符串。这适用于我的机器,但似乎不是一个非常强大的解决方案!有没有类似kAudioHardwarePropertyBuiltInOutputDevice 的东西?
【问题讨论】:
标签: objective-c macos core-audio