Audio Engine

NIMH ML supports two audio application programming interfaces (APIs), XAudio2 and Windows Audio Session API (WASAPI). WASAPI can run in two different modes (shared and exclusive), so there are three options altogether.

In terms of latency, XAudio2 is the longest, WASAPI in the shared mode (WASAPI Shared) is shorter and WASAPI in the exclusive mode (WASAPI Exclusive) is the shortest. As for the stability of audio playback, however, XAudio2 is most stable, regardless of the quality of driver software. WASAPI more relies on the driver support and its performance varies depending the hardware and the sound driver. In WASAPI Exclusive, the number of sounds that can be simultaneously played is limited to one, due to its exclusive access to the audio endpoint (e.g., speakers). Choose the API wisely, considering the purpose of audio playback.

  1. Changing the playback device for XAudio2
  2. XAudio2 always uses the default playback device of the system. Click the play icon to test the device currently in use. To change the default device, open the sound control panel by clicking [...]. Then choose a playback device that you want to make a default device on the panel with a right-mouse-click and select [Set as Default Device] in the resulting menu, as shown below. To reflect the change of the default device on the menu, click the reload icon right next to the playback button ().

  3. Changing the playback device for WASAPI
  4. For WASAPI, you can switch between devices on the menu. WASAPI Exclusive needs to set the output format additionally. Use the playback button to test the selected device and format.

  5. Updating the sound driver for WASAPI Shared
  6. In Windows 10, WASAPI Shared can play sounds with shorter latencies. To use this feature, the user application must be recompiled with a new interface (IAudioClient3), but also a driver that supports the feature should be installed.

    1. Start Device Manager. Under Sound, video and game controllers, right-click on the device that you chose and select Update driver.

    2. Select Browse my computer for drivers and then Let me pick from a list of available drivers on my computer.



    3. Select High Definition Audio Device and click [Next]. Click [Yes], if a warning pops up. Rebooting may be required.



The National Institute of Mental Health (NIMH) is part of the National Institutes of Health (NIH), a component of the U.S. Department of Health and Human Services.