From 8ab36069123a8b38e247ace55f8a6b3e6ee14f5f Mon Sep 17 00:00:00 2001 From: Mason Remaley Date: Fri, 4 Mar 2022 23:42:18 -0500 Subject: [PATCH] Hardcodes wasapi GUIDs when compiling as C --- src/wasapi.c | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/src/wasapi.c b/src/wasapi.c index e3a8fb8..205010d 100644 --- a/src/wasapi.c +++ b/src/wasapi.c @@ -30,26 +30,10 @@ #define E_NOTFOUND 0x80070490 #endif //E_NOTFOUND -#ifdef __cplusplus -// In C++ mode, IsEqualGUID() takes its arguments by reference -#define IS_EQUAL_GUID(a, b) IsEqualGUID(*(a), *(b)) -#define IS_EQUAL_IID(a, b) IsEqualIID((a), *(b)) - -// And some constants are passed by reference -#define IID_IAUDIOCLIENT (IID_IAudioClient) -#define IID_IMMENDPOINT (IID_IMMEndpoint) -#define IID_IAUDIOCLOCKADJUSTMENT (IID_IAudioClockAdjustment) -#define IID_IAUDIOSESSIONCONTROL (IID_IAudioSessionControl) -#define IID_IAUDIORENDERCLIENT (IID_IAudioRenderClient) -#define IID_IMMDEVICEENUMERATOR (IID_IMMDeviceEnumerator) -#define IID_IAUDIOCAPTURECLIENT (IID_IAudioCaptureClient) -#define IID_ISIMPLEAUDIOVOLUME (IID_ISimpleAudioVolume) -#define CLSID_MMDEVICEENUMERATOR (CLSID_MMDeviceEnumerator) -#define PKEY_DEVICE_FRIENDLYNAME (PKEY_Device_FriendlyName) -#define PKEY_AUDIOENGINE_DEVICEFORMAT (PKEY_AudioEngine_DeviceFormat) - // And some GUID are never implemented (Ignoring the INITGUID define) -static const CLSID CLSID_MMDeviceEnumerator = __uuidof(MMDeviceEnumerator); +static const CLSID CLSID_MMDeviceEnumerator = { + 0xbcde0395, 0xe52f, 0x467c, {0x8e, 0x3d, 0xc4, 0x57, 0x92, 0x91, 0x69, 0x2e} +}; static const IID IID_IMMDeviceEnumerator = { //MIDL_INTERFACE("A95664D2-9614-4F35-A746-DE8DB63617E6") 0xa95664d2, 0x9614, 0x4f35, {0xa7, 0x46, 0xde, 0x8d, 0xb6, 0x36, 0x17, 0xe6} @@ -91,6 +75,24 @@ static const IID IID_ISimpleAudioVolume = { 0x87ce5498, 0x68d6, 0x44e5,{ 0x92, 0x15, 0x6d, 0xa4, 0x7e, 0xf8, 0x83, 0xd8 } }; +#ifdef __cplusplus +// In C++ mode, IsEqualGUID() takes its arguments by reference +#define IS_EQUAL_GUID(a, b) IsEqualGUID(*(a), *(b)) +#define IS_EQUAL_IID(a, b) IsEqualIID((a), *(b)) + +// And some constants are passed by reference +#define IID_IAUDIOCLIENT (IID_IAudioClient) +#define IID_IMMENDPOINT (IID_IMMEndpoint) +#define IID_IAUDIOCLOCKADJUSTMENT (IID_IAudioClockAdjustment) +#define IID_IAUDIOSESSIONCONTROL (IID_IAudioSessionControl) +#define IID_IAUDIORENDERCLIENT (IID_IAudioRenderClient) +#define IID_IMMDEVICEENUMERATOR (IID_IMMDeviceEnumerator) +#define IID_IAUDIOCAPTURECLIENT (IID_IAudioCaptureClient) +#define IID_ISIMPLEAUDIOVOLUME (IID_ISimpleAudioVolume) +#define CLSID_MMDEVICEENUMERATOR (CLSID_MMDeviceEnumerator) +#define PKEY_DEVICE_FRIENDLYNAME (PKEY_Device_FriendlyName) +#define PKEY_AUDIOENGINE_DEVICEFORMAT (PKEY_AudioEngine_DeviceFormat) + #else #define IS_EQUAL_GUID(a, b) IsEqualGUID((a), (b)) #define IS_EQUAL_IID(a, b) IsEqualIID((a), (b))