| 59 | } |
| 60 | |
| 61 | ovrResult 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 | |
| 89 | OVR_PUBLIC_FUNCTION(ovrResult) ovr_GetAudioDeviceOutWaveId(UINT* deviceOutId) |
| 90 | { |
no outgoing calls
no test coverage detected