| 292 | } |
| 293 | |
| 294 | OVR_PUBLIC_FUNCTION(ovrResult) ovr_GetAudioDeviceOutGuid(GUID* deviceOutGuid) |
| 295 | { |
| 296 | REV_TRACE(ovr_GetAudioDeviceOutGuid); |
| 297 | |
| 298 | if (!deviceOutGuid) |
| 299 | return ovrError_InvalidParameter; |
| 300 | |
| 301 | // Query and cache the result |
| 302 | static GUID cachedGuid = GUID_NULL; |
| 303 | if (cachedGuid == GUID_NULL) |
| 304 | { |
| 305 | char endpoint[OVR_AUDIO_MAX_DEVICE_STR_SIZE] = {}; |
| 306 | vr::ETrackedPropertyError error = vr::TrackedProp_Success; |
| 307 | uint32_t size = vr::VRSystem()->GetStringTrackedDeviceProperty( |
| 308 | vr::k_unTrackedDeviceIndex_Hmd, |
| 309 | vr::Prop_Audio_DefaultPlaybackDeviceId_String, |
| 310 | endpoint, OVR_AUDIO_MAX_DEVICE_STR_SIZE, &error); |
| 311 | if (error == vr::TrackedProp_Success) |
| 312 | { |
| 313 | HRESULT com = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); |
| 314 | ovrResult result = AudioEndPointToGuid(endpoint, size, &cachedGuid); |
| 315 | if (SUCCEEDED(com)) |
| 316 | CoUninitialize(); |
| 317 | if (OVR_FAILURE(result)) |
| 318 | return result; |
| 319 | } |
| 320 | else |
| 321 | { |
| 322 | // Return the default without caching so we can attempt again later |
| 323 | HRESULT hr = GetDeviceID(&DSDEVID_DefaultPlayback, deviceOutGuid); |
| 324 | return SUCCEEDED(hr) ? ovrSuccess : ovrError_AudioInputDeviceNotFound; |
| 325 | } |
| 326 | } |
| 327 | *deviceOutGuid = cachedGuid; |
| 328 | return ovrSuccess; |
| 329 | } |
| 330 | |
| 331 | OVR_PUBLIC_FUNCTION(ovrResult) ovr_GetAudioDeviceInGuidStr(WCHAR deviceInStrBuffer[OVR_AUDIO_MAX_DEVICE_STR_SIZE]) |
| 332 | { |
nothing calls this directly
no test coverage detected