wasapi: Patched to compile on non-UWP WinRT builds.
authorRyan C. Gordon <icculus@icculus.org>
Sun, 31 Dec 2017 03:34:16 -0500
changeset 117933ec030c1ca8e
parent 11792 ff2d4c0c636d
child 11794 c40f03dda342
wasapi: Patched to compile on non-UWP WinRT builds.
src/audio/wasapi/SDL_wasapi.c
     1.1 --- a/src/audio/wasapi/SDL_wasapi.c	Sun Dec 31 03:17:18 2017 -0500
     1.2 +++ b/src/audio/wasapi/SDL_wasapi.c	Sun Dec 31 03:34:16 2017 -0500
     1.3 @@ -84,7 +84,7 @@
     1.4  static WCHAR *
     1.5  WStrDupe(const WCHAR *wstr)
     1.6  {
     1.7 -    const int len = (WStrLen(wstr) + 1) * sizeof (WCHAR);
     1.8 +    const size_t len = (WStrLen(wstr) + 1) * sizeof (WCHAR);
     1.9      WCHAR *retval = (WCHAR *) SDL_malloc(len);
    1.10      if (retval) {
    1.11          SDL_memcpy(retval, wstr, len);
    1.12 @@ -323,7 +323,7 @@
    1.13  {
    1.14      while (RecoverWasapiIfLost(this) && this->hidden->client && this->hidden->event) {
    1.15          /*SDL_Log("WAITDEVICE");*/
    1.16 -        if (WaitForSingleObject(this->hidden->event, INFINITE) == WAIT_OBJECT_0) {
    1.17 +        if (WaitForSingleObjectEx(this->hidden->event, INFINITE, FALSE) == WAIT_OBJECT_0) {
    1.18              const UINT32 maxpadding = this->spec.samples;
    1.19              UINT32 padding = 0;
    1.20              if (!WasapiFailed(this, IAudioClient_GetCurrentPadding(this->hidden->client, &padding))) {
    1.21 @@ -530,7 +530,12 @@
    1.22  
    1.23      SDL_assert(client != NULL);
    1.24  
    1.25 +#ifdef __WINRT__  /* CreateEventEx() arrived in Vista, so we need an #ifdef for XP. */
    1.26 +    this->hidden->event = CreateEventEx(NULL, NULL, 0, EVENT_ALL_ACCESS);
    1.27 +#else
    1.28      this->hidden->event = CreateEventW(NULL, 0, 0, NULL);
    1.29 +#endif
    1.30 +
    1.31      if (this->hidden->event == NULL) {
    1.32          return WIN_SetError("WASAPI can't create an event handle");
    1.33      }