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

Function GetDefaultAudioEndpoint

ReviveXR/REV_CAPI_Audio.cpp:61–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59}
60
61ovrResult GetDefaultAudioEndpoint(EDataFlow endpoint, WCHAR deviceStrBuffer[OVR_AUDIO_MAX_DEVICE_STR_SIZE])
62{
63 if (!deviceStrBuffer)
64 return ovrError_InvalidParameter;
65
66 Microsoft::WRL::ComPtr<IMMDeviceEnumerator> pEnumerator;
67 const CLSID CLSID_MMDeviceEnumerator = __uuidof(MMDeviceEnumerator);
68 const IID IID_IMMDeviceEnumerator = __uuidof(IMMDeviceEnumerator);
69 HRESULT hr = CoCreateInstance(
70 CLSID_MMDeviceEnumerator, NULL,
71 CLSCTX_ALL, IID_IMMDeviceEnumerator,
72 &pEnumerator);
73 if (FAILED(hr))
74 return ovrError_AudioComError;
75
76 Microsoft::WRL::ComPtr<IMMDevice> pDevice;
77 hr = pEnumerator->GetDefaultAudioEndpoint(eRender, eConsole, &pDevice);
78 if (FAILED(hr))
79 return ovrError_AudioDeviceNotFound;
80
81 LPWSTR pGuid;
82 hr = pDevice->GetId(&pGuid);
83 if (FAILED(hr))
84 return ovrError_AudioComError;
85 wcscpy_s(deviceStrBuffer, OVR_AUDIO_MAX_DEVICE_STR_SIZE, pGuid);
86 return ovrSuccess;
87}
88
89OVR_PUBLIC_FUNCTION(ovrResult) ovr_GetAudioDeviceOutWaveId(UINT* deviceOutId)
90{

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected