microsoft / DirectXTK12

The DirectX Tool Kit (aka DirectXTK12) is a collection of helper classes for writing DirectX 12 code in C++
https://walbourn.github.io/directx-tool-kit-for-directx-12/
MIT License
1.45k stars 369 forks source link

Rework audio device enumeration for XAudio2.9 #162

Closed walbourn closed 1 year ago

walbourn commented 1 year ago

XAudio 2.8 on Windows 8 required the use of Windows Runtime APIs for device enumeration. XAudio2.9 on Windows 10 (18362) or later and all versions of XAudio2Redist support both Windows Runtime device ids -and- standard WASAPI device ids.

This PR reworks the device enumeration to use WASAPI enumeration for most cases, and WinRT enumeration for the UWP platform and for XAudio 2.8 scenarios only.

In addition, this PR returns correct values for GetOutputFormat().Format.wBitsPerSample where possible. It previously always returned a value of 16.

For Windows Server 2019 (17763) or other older Windows 10 scenarios, the recommendation is to use XAudio2Redist instead of the built-in XAudio 2.9.

walbourn commented 1 year ago

See DX11 for comments on this review.