You can use (as pointed out by Kozlow_Sergey in the comments) DirectX to enumerate the devices;
#include <iostream>
#include <stdio.h>
#include <dsound.h>
using namespace std;
#ifdef UNICODE
BOOL CALLBACK DirectSoundEnum(LPGUID guid, LPCWSTR desc, LPCWSTR module, LPVOID context)
{
wcout << "Device: " << desc << endl;
return TRUE;
}
#else
BOOL CALLBACK DirectSoundEnum(LPGUID guid, LPCSTR desc, LPCSTR module, LPVOID context)
{
cout << "Device: " << desc << endl;
return TRUE;
}
#endif
int main(int argc, char* argv[])
{
if (DirectSoundEnumerate(DirectSoundEnum, NULL) != DS_OK)
cerr << "Failed to enumerate sound devices";
return 0;
}
This snippet requires that you link against
d3dx9.lib and
dsound.lib (actually you might be able to skip the first one).
Hope this helps,
Fredrik Bornander