From 77bb49b7a7d8b44820335b14cf75ba7f5e221680 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Sun, 31 Dec 2017 03:34:16 -0500 Subject: [PATCH] wasapi: Patched to compile on non-UWP WinRT builds. --- src/audio/wasapi/SDL_wasapi.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/audio/wasapi/SDL_wasapi.c b/src/audio/wasapi/SDL_wasapi.c index f7f04e881a9e8..fe45e6ff38275 100644 --- a/src/audio/wasapi/SDL_wasapi.c +++ b/src/audio/wasapi/SDL_wasapi.c @@ -84,7 +84,7 @@ WStrLen(const WCHAR *wstr) static WCHAR * WStrDupe(const WCHAR *wstr) { - const int len = (WStrLen(wstr) + 1) * sizeof (WCHAR); + const size_t len = (WStrLen(wstr) + 1) * sizeof (WCHAR); WCHAR *retval = (WCHAR *) SDL_malloc(len); if (retval) { SDL_memcpy(retval, wstr, len); @@ -323,7 +323,7 @@ WASAPI_WaitDevice(_THIS) { while (RecoverWasapiIfLost(this) && this->hidden->client && this->hidden->event) { /*SDL_Log("WAITDEVICE");*/ - if (WaitForSingleObject(this->hidden->event, INFINITE) == WAIT_OBJECT_0) { + if (WaitForSingleObjectEx(this->hidden->event, INFINITE, FALSE) == WAIT_OBJECT_0) { const UINT32 maxpadding = this->spec.samples; UINT32 padding = 0; if (!WasapiFailed(this, IAudioClient_GetCurrentPadding(this->hidden->client, &padding))) { @@ -530,7 +530,12 @@ WASAPI_PrepDevice(_THIS, const SDL_bool updatestream) SDL_assert(client != NULL); +#ifdef __WINRT__ /* CreateEventEx() arrived in Vista, so we need an #ifdef for XP. */ + this->hidden->event = CreateEventEx(NULL, NULL, 0, EVENT_ALL_ACCESS); +#else this->hidden->event = CreateEventW(NULL, 0, 0, NULL); +#endif + if (this->hidden->event == NULL) { return WIN_SetError("WASAPI can't create an event handle"); }