| 278 | } |
| 279 | |
| 280 | OVR_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 | |
| 317 | OVR_PUBLIC_FUNCTION(ovrResult) ovr_GetAudioDeviceInGuidStr(WCHAR deviceInStrBuffer[OVR_AUDIO_MAX_DEVICE_STR_SIZE]) |
| 318 | { |
nothing calls this directly
no test coverage detected