MCPcopy Create free account
hub / github.com/LibreVR/Revive / ovr_GetAudioDeviceOutGuid

Function ovr_GetAudioDeviceOutGuid

ReviveXR/REV_CAPI_Audio.cpp:280–315  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

278}
279
280OVR_PUBLIC_FUNCTION(ovrResult) ovr_GetAudioDeviceOutGuid(GUID* deviceOutGuid)
281{
282 REV_TRACE(ovr_GetAudioDeviceOutGuid);
283
284 if (!deviceOutGuid)
285 return ovrError_InvalidParameter;
286
287 // Query and cache the result
288 static GUID cachedGuid = GUID_NULL;
289 if (cachedGuid == GUID_NULL)
290 {
291 if (Runtime::Get().AudioDevice)
292 {
293 XR_FUNCTION(g_Instance, GetAudioOutputDeviceGuidOculus);
294
295 WCHAR endpoint[OVR_AUDIO_MAX_DEVICE_STR_SIZE];
296 if (XR_FAILED(GetAudioOutputDeviceGuidOculus(g_Instance, endpoint)))
297 return ovrError_AudioOutputDeviceNotFound;
298
299 HRESULT com = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
300 ovrResult result = AudioEndPointToGuid(endpoint, &cachedGuid);
301 if (SUCCEEDED(com))
302 CoUninitialize();
303 if (OVR_FAILURE(result))
304 return result;
305 }
306 else
307 {
308 HRESULT hr = GetDeviceID(&DSDEVID_DefaultPlayback, &cachedGuid);
309 if (FAILED(hr))
310 ovrError_AudioOutputDeviceNotFound;
311 }
312 }
313 *deviceOutGuid = cachedGuid;
314 return ovrSuccess;
315}
316
317OVR_PUBLIC_FUNCTION(ovrResult) ovr_GetAudioDeviceInGuidStr(WCHAR deviceInStrBuffer[OVR_AUDIO_MAX_DEVICE_STR_SIZE])
318{

Callers

nothing calls this directly

Calls 1

AudioEndPointToGuidFunction · 0.70

Tested by

no test coverage detected