XAudio2 Debugging Facilities
The debug version of the XAudio2 engine validates parameters, and provides detailed warning and error messages.
Setting the Debug Logging Level at Run Time
You can set the level of debugging information shown by XAudio2 at any time by filling out an XAUDIO2_DEBUG_CONFIGURATION structure with the flags for the desired logging level, and then pass the structure to the IXAudio2::SetDebugConfiguration method. Values passed to the IXAudio2::SetDebugConfiguration method always override any default values that were set in the Windows registry.
Debug Support
The debugging facilities are always available for XAUDIO2 in Windows 8.x, Windows 10, Windows 11, and when using the XAudio2Redist package.
For the legacy DirectX SDK versions of XAUDIO2, you must use XAUDIO2_DEBUG_ENGINE when creating the XAUDIO2 object with XAudio2Create and the system must have the DirectX SDK Developer Runtime installed for debugging to be supported.
Enabling Event Tracing for Windows (ETW) for XAudio2
With XAudio 2.8 or later, all debugging information is logged via ETW. To enable logging of these events, use the following steps:
- Search for "Event Viewer" on your local system and run this application.
- Select View on the menu bar, and set the check-mark on Show Analytic and Debug Logs.
- Using the tree view, select Applications and Services Logs / Microsoft / Windows / XAudio2.
- Right-click on Microsoft Windows XAudio2 debug logging and select "Properties".
- Click the check-box on "Enable Log", and hit "OK". You can optionally change the log location which defaults to
%SystemRoot%\System32\Winevt\Logs\Microsoft-Windows-XAudio2%4Debug.etl
.
Run your scenarios as normal and when you want to see the recent activity, open the ETL log file and look for events. There are a number of tools you can use, including the Event Viewer via "Open Saved Log..." in the actions pane.
For more information, see Event Tracing.
Related topics