From 33e54c8adfc0e860408e98fed2e5ea33e0235c41 Mon Sep 17 00:00:00 2001 From: dmitrykos Date: Tue, 2 Mar 2010 19:08:13 +0000 Subject: [PATCH] +++ wasapi: corrected PaWasapi_Initialize() behavior in case of OS back-end failure: WASAPI will not be added to a list of available APIs now (instead of throwing error to InitializeHostApis() that causes PA initialization break), error is thrown only on low-memory condition (default behavior) --- src/hostapi/wasapi/pa_win_wasapi.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/hostapi/wasapi/pa_win_wasapi.cpp b/src/hostapi/wasapi/pa_win_wasapi.cpp index 9c243e2..a160e50 100644 --- a/src/hostapi/wasapi/pa_win_wasapi.cpp +++ b/src/hostapi/wasapi/pa_win_wasapi.cpp @@ -647,7 +647,7 @@ PaError PaWasapi_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiInd CoInitialize(NULL); - PaError result = paUnanticipatedHostError; + PaError result = paNoError; PaWasapiHostApiRepresentation *paWasapi; PaDeviceInfo *deviceInfoArray; @@ -674,9 +674,9 @@ PaError PaWasapi_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiInd (*hostApi)->info.defaultOutputDevice = paNoDevice; HRESULT hResult = S_OK; - IMMDeviceCollection* pEndPoints=0; - paWasapi->enumerator = 0; - + IMMDeviceCollection *pEndPoints = NULL; + + paWasapi->enumerator = NULL; hResult = CoCreateInstance(__uuidof(MMDeviceEnumerator), NULL,CLSCTX_INPROC_SERVER, __uuidof(IMMDeviceEnumerator), (void**)&paWasapi->enumerator); @@ -685,7 +685,7 @@ PaError PaWasapi_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiInd // getting default device ids in the eMultimedia "role" { { - IMMDevice* defaultRenderer=0; + IMMDevice *defaultRenderer = NULL; hResult = paWasapi->enumerator->GetDefaultAudioEndpoint(eRender, eMultimedia, &defaultRenderer); if (hResult != S_OK) { @@ -694,7 +694,7 @@ PaError PaWasapi_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiInd } else { - WCHAR* pszDeviceId = NULL; + WCHAR *pszDeviceId = NULL; hResult = defaultRenderer->GetId(&pszDeviceId); IF_FAILED_JUMP(hResult, error); wcscpy_s(paWasapi->defaultRenderer, MAX_STR_LEN-1, pszDeviceId); @@ -945,6 +945,7 @@ error: SAFE_RELEASE(pEndPoints); Terminate((PaUtilHostApiRepresentation *)paWasapi); + (*hostApi) = NULL; return result; } -- 2.43.0