1 #pragma once 2 3 #define WIN32_MEAN_AND_LEAN 4 #include <windows.h> 5 #include <initguid.h> 6 #include <mmdeviceapi.h> 7 #include <audioclient.h> 8 #include <propsys.h> 9 10 #ifdef __MINGW32__ 11 12 #ifdef DEFINE_PROPERTYKEY 13 #undef DEFINE_PROPERTYKEY 14 #endif 15 16 /* clang-format off */ 17 18 #define DEFINE_PROPERTYKEY(id, a, b, c, d, e, f, g, h, i, j, k, l) \ 19 const PROPERTYKEY id = { { a,b,c, { d,e,f,g,h,i,j,k, } }, l }; 20 DEFINE_PROPERTYKEY(PKEY_Device_FriendlyName, \ 21 0xa45c254e, 0xdf1c, 0x4efd, 0x80, \ 22 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 14); 23 24 /* clang-format on */ 25 26 #else 27 28 #include <functiondiscoverykeys_devpkey.h> 29 30 #endif 31 32 #include <vector> 33 #include <string> 34 35 struct AudioDeviceInfo { 36 std::string name; 37 std::string id; 38 }; 39 40 std::string GetDeviceName(IMMDevice *device); 41 void GetWASAPIAudioDevices(std::vector<AudioDeviceInfo> &devices, bool input); 42