How to identify the default audio devices from a .Net application?
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?
"Proper audio devices" probably means - devices which are already set as DEFAULT in Windows.
E.g. Skype (or X-Lite) selects in most cases au开发者_如何学Godio 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.
I suppose that solutions for XP and Vista(7) could be different.
Thank you in advance!
On Vista and Win7 you could use the MMDevice API IMMDeviceEnumerator::GetDefaultAudioEndpoint, and then use MMDevice::GetId to get the string describing this device.
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.
I've recently had to do something similar, but support multiple windows versions. I ended up using NAudio because of its simplicity. There are several example apps bundled in so you can see how to use it.
精彩评论