如何识别从.NET应用程序的默认音频设备? [英] How to identify the default audio devices from a .Net application?
问题描述
我有点糊涂了。有没有简单的方法,在我的VoIP .NET应用程序设置正确的音频设备(输入/输出)W / O使用的DirectX?
I'm a bit confused. Is there any simple way to set proper audio devices (in/out) in my VoIP .NET application w/o using of DirectX?
正确的音频设备可能意味着 - 这已经被设置为默认的Windows设备
"Proper audio devices" probably means - devices which are already set as DEFAULT in Windows.
例如。 Skype的(或X-精简版)在大多数情况下,选择的音频设备正常。但如何?刚开设备列表中没有解决的问题,因为我不知道该如何选择合适的。
E.g. Skype (or X-Lite) selects in most cases audio devices properly. But How? Just getting of list of devices don't solve the problem, cause I don't know how to select the proper one.
我想,对于XP和Vista解决方案(7)可以是不同的。
I suppose that solutions for XP and Vista(7) could be different.
感谢你在前进!
推荐答案
在Vista和Win7的,你可以使用MMDevice API IMMDeviceEnumerator :: GetDefaultAudioEndpoint,然后用MMDevice :: GETID获得描述此设备的字符串。
On Vista and Win7 you could use the MMDevice API IMMDeviceEnumerator::GetDefaultAudioEndpoint, and then use MMDevice::GetId to get the string describing this device.
在其他系统(包括Vista和Win7),可以使用通过设备ID = WAVE_MAPPER(-1)的较旧的MME API waveInGetDevCaps和waveOutGetDevCaps以得到描述默认设备的字符串。
On other systems (including Vista and Win7) you can use the older MME API waveInGetDevCaps and waveOutGetDevCaps using deviceID=WAVE_MAPPER (-1) to get the string describing the default device.
这篇关于如何识别从.NET应用程序的默认音频设备?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!