| 336 | } |
| 337 | |
| 338 | OVR_PUBLIC_FUNCTION(ovrResult) ovr_GetAudioDeviceInGuid(GUID* deviceInGuid) |
| 339 | { |
| 340 | REV_TRACE(ovr_GetAudioDeviceInGuid); |
| 341 | |
| 342 | if (!deviceInGuid) |
| 343 | return ovrError_InvalidParameter; |
| 344 | |
| 345 | // Query and cache the result |
| 346 | static GUID cachedGuid = GUID_NULL; |
| 347 | if (cachedGuid == GUID_NULL) |
| 348 | { |
| 349 | if (Runtime::Get().AudioDevice) |
| 350 | { |
| 351 | XR_FUNCTION(g_Instance, GetAudioInputDeviceGuidOculus); |
| 352 | |
| 353 | WCHAR endpoint[OVR_AUDIO_MAX_DEVICE_STR_SIZE]; |
| 354 | if (XR_FAILED(GetAudioInputDeviceGuidOculus(g_Instance, endpoint))) |
| 355 | return ovrError_AudioInputDeviceNotFound; |
| 356 | |
| 357 | HRESULT com = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); |
| 358 | ovrResult result = AudioEndPointToGuid(endpoint, &cachedGuid); |
| 359 | if (SUCCEEDED(com)) |
| 360 | CoUninitialize(); |
| 361 | if (OVR_FAILURE(result)) |
| 362 | return result; |
| 363 | } |
| 364 | else |
| 365 | { |
| 366 | HRESULT hr = GetDeviceID(&DSDEVID_DefaultCapture, &cachedGuid); |
| 367 | if (FAILED(hr)) |
| 368 | return ovrError_AudioInputDeviceNotFound; |
| 369 | } |
| 370 | } |
| 371 | *deviceInGuid = cachedGuid; |
| 372 | return ovrSuccess; |
| 373 | } |
nothing calls this directly
no test coverage detected