问题
I'm a complete beginner with regards to IMMDevice, and I need to ask what a good, easy way to get some device out of information out of it is. In my program, I've already successfully set a pointer to one of those with GetDefaultAudioEndpoint(). Now I just need to be able to get some basic information out of it, like some speaker info or the ID of the speaker or anything like that. What's a good way to do this that a total beginner would be able to pick up on? Thanks!
回答1:
Devices have various properties attached, and you can read them from a device property store. MSDN gives you a code snippet here:
Audio Endpoint Devices > Device Properties
You can also use pre-built utilities to quickly check your devices and see what you can obtain from a IMMDevice
pointer:
- How to enumerate audio endpoint (IMMDevice) properties on your system
- Enumerate Audio ‘MMDevice’s
The latter presents you the properties like this:
And you can check source code here http://www.alax.info/trac/public/browser/trunk/Utilities/EnumerateAudioDevices/MainDialog.h#L72 that it starts from as much as having a IMMDevice
pointer on hands in line 72.
来源:https://stackoverflow.com/questions/9773358/how-do-i-get-information-out-of-immdevice