获取 waveIn 设备的全名 [英] Get the full name of a waveIn device

查看:25
本文介绍了获取 waveIn 设备的全名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用 waveInGetDevCaps获取 waveIn 设备的名称,但 WAVEINCAPS 结构只支持 31 个字符加上一个空值,这意味着在我的电脑上,我得到的设备名称被截断了:

I have been using waveInGetDevCaps to get the name of waveIn devices, but the WAVEINCAPS structure only supports 31 characters plus a null, meaning that on my computer, the device names I get back are truncated:

Microphone / Line In (SigmaTel 
Microphone Array (SigmaTel High, 

我确信一定有办法获得完整的设备名称,但有人知道那是什么吗?

I am sure that there must be a way of getting the full device name, but does anyone know what that is?

推荐答案

是的,有一个解决方法.我已经在运输代码中多次解决了这个问题.

Yes, there's a workaround. I've solved this problem several times in shipping code.

使用 DirectSoundCapture 枚举音频捕获设备.API 是 DirectSoundCaptureEnumerate.它将返回设备的全长名称.

Enumerate audio capture devices with DirectSoundCapture. The API is DirectSoundCaptureEnumerate. It will return you the full length name of the devices.

当然,您可能会想这很好,但我的其余代码设置为使用 Wave API,而不是 DirectSound.我不想将其全部切换.那么如何映射 GUIDDirectSoundCaptureEnumerate 返回的 ID 为 WaveIn API 使用的整数 ID?"

Of course, you're probably thinking "That's great, but the rest of my code is setup to use the Wave API, not DirectSound. I don't want to switch it all over. So how can I map the GUID IDs returned by DirectSoundCaptureEnumerate to the integer IDs used by the WaveIn API?"

解决方案是为 DirectSoundPrivate 对象创建 CoCreateInstance(或直接从 dsound.dll 调用 GetClassObject)以获取指向 IKsPropertySet 接口的指针.从此界面中,您可以获得 DSound GUID 到 Wave ID 的映射.有关详细信息,请参阅此网页:

The solution is to CoCreateInstance for the DirectSoundPrivate object (or call GetClassObject directly from dsound.dll) to get a pointer to an IKsPropertySet interface. From this interface, you can obtain the DSound GUID to Wave ID mapping. For more details see this web page:

http://msdn.microsoft.com/en-us/library/bb206182(VS.85).aspx

您想使用上面列出的网页中所述的 DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING.

You want to use the DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING as described on the web page listed above.

这篇关于获取 waveIn 设备的全名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆