views:

213

answers:

1

I'm using the winmm api to deal with audio. I'm using waveInGetDeviceCaps and waveInMessage to uniquely identify an "audio line". Everything works fine, except that in Vista, the name of the device is capped in 32 chars by the WaveInCaps struct.

To work around that, I'm envisioning using the core api when OS version is >= Vista. I'm using the IMMDeviceEnumerator.GetDevice and IMMDeviceEnumerator.EnumAudioEndpoints to gather audio line information, but I'm not sure how to tell that one device under core api relates to one entry under the waveXx api.

I guess I could compare the device path of both, but that would go against MS's recommendation of treating the device path string as "opaque".

What would you say?

+1  A: 

This scenario is described in http://msdn.microsoft.com/en-us/library/dd370819(VS.85).aspx

Han
Great! This will help me with other stuff as well, such as getting the guid of that specific endpoint.
Padu Merloti
What do you mean "guid of that endpoint"? Do you mean the DSound GUID? That's available in PKEY_AudioEndpoint_GUID.You can also use http://msdn.microsoft.com/en-us/library/ms790392.aspx DRV_QUERYDEVICEINTERFACE and DRV_QUERYENDPOINTID to retrieve the endpoint ID for a given wave or mixer ID.
Larry Osterman
Right, which I already do for other reasons. The big picture here is the following: I'm developing a multimedia framework to capture sound based on the waveInXxx API. First I had to relate a given input line to its audio device (setupAPI), and for that I'm using the DRV_QUERYDEVICEINTERFACE.The problem I'm having with the waveInXxx api is that it truncates the device name under Vista, so I'm appealing to direct sound to get that full name.
Padu Merloti
@Larry: I think I'm closer to a solution. I wasn't able to find `DRV_QUERYENDPOINTID` anywhere, but using waveInMessage with `DRV_QUERYSTRINGID` I was able to get a bit closer to what I want. I got the following string from it*00000001:00000037:{0.0.1.00000000}.{54d2b8ce-17da-4324-ac30-e8a1003ab430}:widMessage:00000000*and the following string from IMMDevice.GetID:*{0.0.1.00000000}.{f1821ba1-3c39-49fb-9f5b-d3d9a85cffe8}*I could compare the strings right now, but it'd be better if there's another message that would bring strings in similar formats and I could treat them as opaque.
Padu Merloti
@Han: do you know where `DRV_QUERYFUNCTIONINSTANCEID is` declared?
Padu Merloti
Bah... sorry about that. I was using an old WinDDK. I think I'm good now.
Padu Merloti
Padu: Sorry, I got the wrong symbol, QUERYFUNCTIONINSTANCEID is the right symbol.
Larry Osterman
No problems, I got it. Do you think the result the resulting string from this function is reliable? I mean... will it work under all platforms so far?
Padu Merloti