Skip to content

Commit 4c199f9

Browse files
committed
Fix some compilation errors with the C++ build.
1 parent c5f47fe commit 4c199f9

File tree

1 file changed

+15
-25
lines changed

1 file changed

+15
-25
lines changed

miniaudio.h

+15-25
Original file line numberDiff line numberDiff line change
@@ -11353,13 +11353,6 @@ IMPLEMENTATION
1135311353
#define CLSCTX_ALL 23
1135411354
#endif
1135511355

11356-
#ifndef MAXPNAMELEN
11357-
#define MAXPNAMELEN 32
11358-
#endif
11359-
11360-
typedef UINT MA_MMRESULT;
11361-
typedef UINT MA_MMVERSION;
11362-
1136311356
/* IUnknown is used by both the WASAPI and DirectSound backends. It easier to just declare our version here. */
1136411357
typedef struct ma_IUnknown ma_IUnknown;
1136511358
#endif
@@ -20127,15 +20120,8 @@ static const IID MA_IID_DEVINTERFACE_AUDIO_CAPTURE = {0x2EEF81BE,
2012720120
static const IID MA_IID_IActivateAudioInterfaceCompletionHandler = {0x41D949AB, 0x9862, 0x444A, {0x80, 0xF6, 0xC2, 0x61, 0x33, 0x4D, 0xA5, 0xEB}}; /* 41D949AB-9862-444A-80F6-C261334DA5EB */
2012820121
#endif
2012920122

20130-
static const IID MA_CLSID_MMDeviceEnumerator_Instance = {0xBCDE0395, 0xE52F, 0x467C, {0x8E, 0x3D, 0xC4, 0x57, 0x92, 0x91, 0x69, 0x2E}}; /* BCDE0395-E52F-467C-8E3D-C4579291692E = __uuidof(MMDeviceEnumerator) */
20131-
static const IID MA_IID_IMMDeviceEnumerator_Instance = {0xA95664D2, 0x9614, 0x4F35, {0xA7, 0x46, 0xDE, 0x8D, 0xB6, 0x36, 0x17, 0xE6}}; /* A95664D2-9614-4F35-A746-DE8DB63617E6 = __uuidof(IMMDeviceEnumerator) */
20132-
#ifdef __cplusplus
20133-
#define MA_CLSID_MMDeviceEnumerator MA_CLSID_MMDeviceEnumerator_Instance
20134-
#define MA_IID_IMMDeviceEnumerator MA_IID_IMMDeviceEnumerator_Instance
20135-
#else
20136-
#define MA_CLSID_MMDeviceEnumerator &MA_CLSID_MMDeviceEnumerator_Instance
20137-
#define MA_IID_IMMDeviceEnumerator &MA_IID_IMMDeviceEnumerator_Instance
20138-
#endif
20123+
static const IID MA_CLSID_MMDeviceEnumerator = {0xBCDE0395, 0xE52F, 0x467C, {0x8E, 0x3D, 0xC4, 0x57, 0x92, 0x91, 0x69, 0x2E}}; /* BCDE0395-E52F-467C-8E3D-C4579291692E = __uuidof(MMDeviceEnumerator) */
20124+
static const IID MA_IID_IMMDeviceEnumerator = {0xA95664D2, 0x9614, 0x4F35, {0xA7, 0x46, 0xDE, 0x8D, 0xB6, 0x36, 0x17, 0xE6}}; /* A95664D2-9614-4F35-A746-DE8DB63617E6 = __uuidof(IMMDeviceEnumerator) */
2013920125

2014020126
#if defined(MA_WIN32_DESKTOP) || defined(MA_WIN32_GDK)
2014120127
#define MA_MM_DEVICE_STATE_ACTIVE 1
@@ -21313,7 +21299,7 @@ static ma_result ma_context_create_IMMDeviceEnumerator__wasapi(ma_context* pCont
2131321299

2131421300
*ppDeviceEnumerator = NULL; /* Safety. */
2131521301

21316-
hr = ma_CoCreateInstance(pContext, MA_CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, MA_IID_IMMDeviceEnumerator, (void**)&pDeviceEnumerator);
21302+
hr = ma_CoCreateInstance(pContext, &MA_CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, &MA_IID_IMMDeviceEnumerator, (void**)&pDeviceEnumerator);
2131721303
if (FAILED(hr)) {
2131821304
ma_log_postf(ma_context_get_log(pContext), MA_LOG_LEVEL_ERROR, "[WASAPI] Failed to create device enumerator.");
2131921305
return ma_result_from_HRESULT(hr);
@@ -21387,7 +21373,7 @@ static ma_result ma_context_get_MMDevice__wasapi(ma_context* pContext, ma_device
2138721373
MA_ASSERT(pContext != NULL);
2138821374
MA_ASSERT(ppMMDevice != NULL);
2138921375

21390-
hr = ma_CoCreateInstance(pContext, MA_CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, MA_IID_IMMDeviceEnumerator, (void**)&pDeviceEnumerator);
21376+
hr = ma_CoCreateInstance(pContext, &MA_CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, &MA_IID_IMMDeviceEnumerator, (void**)&pDeviceEnumerator);
2139121377
if (FAILED(hr)) {
2139221378
ma_log_postf(ma_context_get_log(pContext), MA_LOG_LEVEL_ERROR, "[WASAPI] Failed to create IMMDeviceEnumerator.\n");
2139321379
return ma_result_from_HRESULT(hr);
@@ -21765,7 +21751,7 @@ static ma_result ma_context_enumerate_devices__wasapi(ma_context* pContext, ma_e
2176521751
HRESULT hr;
2176621752
ma_IMMDeviceEnumerator* pDeviceEnumerator;
2176721753

21768-
hr = ma_CoCreateInstance(pContext, MA_CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, MA_IID_IMMDeviceEnumerator, (void**)&pDeviceEnumerator);
21754+
hr = ma_CoCreateInstance(pContext, &MA_CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, &MA_IID_IMMDeviceEnumerator, (void**)&pDeviceEnumerator);
2176921755
if (FAILED(hr)) {
2177021756
ma_log_postf(ma_context_get_log(pContext), MA_LOG_LEVEL_ERROR, "[WASAPI] Failed to create device enumerator.");
2177121757
return ma_result_from_HRESULT(hr);
@@ -22694,7 +22680,7 @@ static ma_result ma_device_init__wasapi(ma_device* pDevice, const ma_device_conf
2269422680

2269522681
ma_mutex_init(&pDevice->wasapi.rerouteLock);
2269622682

22697-
hr = ma_CoCreateInstance(pDevice->pContext, MA_CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, MA_IID_IMMDeviceEnumerator, (void**)&pDeviceEnumerator);
22683+
hr = ma_CoCreateInstance(pDevice->pContext, &MA_CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, &MA_IID_IMMDeviceEnumerator, (void**)&pDeviceEnumerator);
2269822684
if (FAILED(hr)) {
2269922685
ma_device_uninit__wasapi(pDevice);
2270022686
ma_log_post(ma_device_get_log(pDevice), MA_LOG_LEVEL_ERROR, "[WASAPI] Failed to create device enumerator.");
@@ -25251,15 +25237,19 @@ is defined. We need to define the types and functions we need manually.
2525125237
#define MA_WHDR_ENDLOOP 0x00000008
2525225238
#define MA_WHDR_INQUEUE 0x00000010
2525325239

25240+
#define MA_MAXPNAMELEN 32
25241+
2525425242
typedef void* MA_HWAVEIN;
2525525243
typedef void* MA_HWAVEOUT;
25244+
typedef UINT MA_MMRESULT;
25245+
typedef UINT MA_MMVERSION;
2525625246

2525725247
typedef struct
2525825248
{
2525925249
WORD wMid;
2526025250
WORD wPid;
2526125251
MA_MMVERSION vDriverVersion;
25262-
CHAR szPname[MAXPNAMELEN];
25252+
CHAR szPname[MA_MAXPNAMELEN];
2526325253
DWORD dwFormats;
2526425254
WORD wChannels;
2526525255
WORD wReserved1;
@@ -25270,7 +25260,7 @@ typedef struct
2527025260
WORD wMid;
2527125261
WORD wPid;
2527225262
MA_MMVERSION vDriverVersion;
25273-
CHAR szPname[MAXPNAMELEN];
25263+
CHAR szPname[MA_MAXPNAMELEN];
2527425264
DWORD dwFormats;
2527525265
WORD wChannels;
2527625266
WORD wReserved1;
@@ -25294,7 +25284,7 @@ typedef struct
2529425284
WORD wMid;
2529525285
WORD wPid;
2529625286
MA_MMVERSION vDriverVersion;
25297-
CHAR szPname[MAXPNAMELEN];
25287+
CHAR szPname[MA_MAXPNAMELEN];
2529825288
DWORD dwFormats;
2529925289
WORD wChannels;
2530025290
WORD wReserved1;
@@ -25309,7 +25299,7 @@ typedef struct
2530925299
WORD wMid;
2531025300
WORD wPid;
2531125301
MA_MMVERSION vDriverVersion;
25312-
CHAR szPname[MAXPNAMELEN];
25302+
CHAR szPname[MA_MAXPNAMELEN];
2531325303
DWORD dwFormats;
2531425304
WORD wChannels;
2531525305
WORD wReserved1;
@@ -25384,7 +25374,7 @@ we can do things generically and typesafely. Names are being kept the same for c
2538425374
*/
2538525375
typedef struct
2538625376
{
25387-
CHAR szPname[MAXPNAMELEN];
25377+
CHAR szPname[MA_MAXPNAMELEN];
2538825378
DWORD dwFormats;
2538925379
WORD wChannels;
2539025380
GUID NameGuid;

0 commit comments

Comments
 (0)