From 107c19daad92c885f44c90b42837c1c34dee8939 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 9 Feb 2017 06:01:14 -0800 Subject: [PATCH] Log the error returned by XAudio2Create() --- src/audio/xaudio2/SDL_xaudio2.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/audio/xaudio2/SDL_xaudio2.c b/src/audio/xaudio2/SDL_xaudio2.c index 3d80bfc28..01ef9ef75 100644 --- a/src/audio/xaudio2/SDL_xaudio2.c +++ b/src/audio/xaudio2/SDL_xaudio2.c @@ -453,6 +453,7 @@ XAUDIO2_Init(SDL_AudioDriverImpl * impl) #else /* XAudio2Create() is a macro that uses COM; we don't load the .dll */ IXAudio2 *ixa2 = NULL; + HRESULT hr = S_FALSE; #if defined(__WIN32__) // TODO, WinRT: Investigate using CoInitializeEx here if (FAILED(WIN_CoInitialize())) { @@ -461,11 +462,12 @@ XAUDIO2_Init(SDL_AudioDriverImpl * impl) } #endif - if (XAudio2Create(&ixa2, 0, XAUDIO2_DEFAULT_PROCESSOR) != S_OK) { + hr = XAudio2Create( &ixa2, 0, XAUDIO2_DEFAULT_PROCESSOR ); + if ( hr != S_OK) { #if defined(__WIN32__) WIN_CoUninitialize(); #endif - SDL_SetError("XAudio2: XAudio2Create() failed at initialization"); + SDL_SetError("XAudio2: XAudio2Create() failed at initialization: 0x%.8x", hr ); return 0; /* not available. */ } IXAudio2_Release(ixa2);