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

查看:364
本文介绍了获取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?

推荐答案

是的,有一个变通方法。我在航运code解决了这个问题好几次。

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.

当然,你可能会想:这是伟大的,但我的code的其余设置使用Wave API,而不是DirectSound的,我不希望在所有打开它。因此,如何我可以通过映射返回DirectSoundCaptureEnumerate由WaveIn API使用的整数ID的GUID的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?"

的解决方案是CoCreateInstance的用于DirectSoundPrivate对象(或直接从dsound.dll调用GetClassObject)来获得的指针IKsPropertySet接口。在此界面中,你可以得到DSOUND GUID来挥挥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:

<一个href=\"http://msdn.microsoft.com/en-us/library/bb206182%28VS.85%29.aspx\">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天全站免登陆