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

Function ovr_GetAudioDeviceOutGuidStr

Revive/REV_CAPI_Audio.cpp:265–292  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

263}
264
265OVR_PUBLIC_FUNCTION(ovrResult) ovr_GetAudioDeviceOutGuidStr(WCHAR deviceOutStrBuffer[OVR_AUDIO_MAX_DEVICE_STR_SIZE])
266{
267 REV_TRACE(ovr_GetAudioDeviceOutGuidStr);
268
269 if (!deviceOutStrBuffer)
270 return ovrError_InvalidParameter;
271
272 char endpoint[OVR_AUDIO_MAX_DEVICE_STR_SIZE] = {};
273 vr::ETrackedPropertyError error = vr::TrackedProp_Success;
274 uint32_t size = vr::VRSystem()->GetStringTrackedDeviceProperty(
275 vr::k_unTrackedDeviceIndex_Hmd,
276 vr::Prop_Audio_DefaultPlaybackDeviceId_String,
277 endpoint, OVR_AUDIO_MAX_DEVICE_STR_SIZE, &error);
278 if (error == vr::TrackedProp_Success)
279 {
280 if (size > OVR_AUDIO_MAX_DEVICE_STR_SIZE)
281 return ovrError_InsufficientArraySize;
282 if (!MultiByteToWideChar(CP_UTF8, MB_PRECOMPOSED, endpoint, size, deviceOutStrBuffer, OVR_AUDIO_MAX_DEVICE_STR_SIZE))
283 return ovrError_MemoryAllocationFailure;
284 return ovrSuccess;
285 }
286
287 HRESULT com = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
288 ovrResult result = GetDefaultAudioEndpoint(eRender, deviceOutStrBuffer);
289 if (SUCCEEDED(com))
290 CoUninitialize();
291 return result;
292}
293
294OVR_PUBLIC_FUNCTION(ovrResult) ovr_GetAudioDeviceOutGuid(GUID* deviceOutGuid)
295{

Callers

nothing calls this directly

Calls 1

GetDefaultAudioEndpointFunction · 0.70

Tested by

no test coverage detected