How to get GUID of default playback device

Hi All.

In my application I need to get the GUID and wave ID of the default playback device. For achieving that I am calling DirectSoundEnumerate and assuming that the second device that gets enumerated (the first is default device but with NULL GUID) is the default device, I am using the GUID of that second device to get its wave id. And this works fine for me.
However if leaving my application open, I am changing the default device from Control Panel to be "device2" instead of "device1", the DirectSoundEnumerate isn't working in the above said way, that is the second device enumerated is again "device1" instead of the new default device ("device2"). So the assupmtion that the second enumerated device is the default one starts being wrong and my application works wrong.
The issue gets resolved only if I restart my application.

Does anyone have any idea why this is so?

Thanks in advance.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!