tags:

views:

624

answers:

1

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?

+3  A: 

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

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

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?"

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

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

selbie
thanks, this is really helpful (although shame it has to be so convoluted)
Mark Heath
that link seems to be broken. do you have another link or at least the title of the article on msdn?
Padu Merloti