CRI ADX  Last Updated: 2024-07-17 10:47 p
Sound Output

About Output Methods

With the PC version of the Atom library, you can select between the following three sound output methods:
  • XAudio2
  • WASAPI
  • PCM output
The sound output method used is determined by the initialization function called.
The library initialization and finalization functions for each method are listed in the table below.
Initialization/Finalization Functions by Sound Output Method
Output Method Initialization Function Finalization Function
XAudio2 criAtomEx_Initialize_PC criAtomEx_Finalize_PC
WASAPI criAtomEx_Initialize_WASAPI criAtomEx_Finalize_WASAPI
PCM output criAtomEx_InitializeForUserPcmOutput_PC criAtomEx_FinalizeForUserPcmOutput_PC
The following sections explain each one of the sound output methods in detail.

(1) XAudio2 Output

When the library is initialized using the criAtomEx_Initialize_PC function, the Atom library will use XAudio2 for sound output.
The following components and actions are required to create and run an application that uses XAudio2.
  • The DirectX SDK (June 2010) must be installed on the PC that will build the application.
  • The DirectX End-User Runtimes (June 2010) must be installed on the PC that will run the application.
  • The CPU in the PC that will run the application must support SSE2 instructions.
  • The application must be linked with "xaudio2.lib".
If no sound is being played when using XAudio2, check the following points:
Attention
The Atom library uses the June 2010 version of XAudio2 (xaudio2_7.dll) for sound output.
Sound will not be output with xaudio2_6.dll or earlier versions, or with xaudio2_8.dll, which is installed by default in Windows 8.
(Using an out-of-date DirectX SDK version in your build environment may lead to access violations or other problems.)
Notes:
You can also initialize XAudio2 explicitly in your application instead of having the Atom library do it internally.
For specific instructions, refer to criatom_samples_xaudio2_initialization.

(2) WASAPI Output

When the library is initialized using the criAtomEx_Initialize_WASAPI function, the Atom library will use WASAPI for sound output.
WASAPI stands for Windows Audio Session API. It was an API introduced with Windows Vista.
WASAPI can only be used with Windows Vista or later operating systems, however it can provide sound playback with lower latencies compared with XAudio2.
With WASAPI sound output, you can also further select between the following two modes:
  • Shared Mode
  • Exclusive Mode
Refer to the following items for details about how to use these modes, as well as their limitations.
Attention
When using WASAPI for the sound output, all sound must be output through the ASR.
(Native voice output cannot be used.)

(3) PCM Data Output

When the library is initialized using the criAtomEx_InitializeForUserPcmOutput_PC function, the Atom library will not perform sound output.
Instead, PCM data will be returned at regular intervals via a registered callback function.
The PCM data received by the callback must then be output separately by your application.
For details on how to output the PCM data, refer to User PCM output.
Attention
When using PCM data output, all sound must be output through the ASR.
(Native voice output cannot be used.)

Downmixing

With the XAudio2 and WASAPI outputs, the CRI Atom library performs downmixing based on the speaker configuration of the playback device.
The downmixing formula used is shown in the table on page Number of Output Channels and Downmixing.
Additional Information:
XAudio2 downmixing is disabled in the PC version of the Atom library.
(This is because the XAudio2 downmixing feature mixes the sound for all speakers equally.)

Number of Playable Channels of the Input Sound Data

The PC version of the Atom library can play up to 8 channels (7.1-channel surround) of sound data.

About the Number of Atom Sound Renderer (ASR) Output Channels

The PC version of the Atom library supports the following number of ASR output channels for the XAudio2 and WASAPI outputs:
  • 8 (7.1-channel)
  • 6 (5.1-channel)
  • 2 (stereo)