How do I get information out of IMMDevice?

匆匆过客 提交于 2019-12-10 10:14:02

问题


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

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