Software PCM mixing

The PCM software mixer allows for multiple application streams to concurrently play to a single hardware device by mixing the audio samples of all of the application streams together. The PCM software mixer directly overlays the hardware PCM device created by the deva-ctrl-* DLL. If enabled, a PCM software mixer capture device gives you the mixed audio stream from the PCM software mixer as a reference audio stream/signal. You can't capture from the PCM software mixer reference if the PCM software mixer isn't actively mixing audio streams. The PCM software mixer is automatically instantiated for each PCM playback device, unless the -o disable_sw_mixer option is provided.

A separate PCM device won't be created for the PCM software mixer, instead the PCM software mixer overlays the hardware device. Because of this, you don't have access to the hardware directly. If you enable PCM software mixer reference streams by setting the appropriate options in the audio configuration file, a new PCM capture device is created, the reference is the index that will be 1 greater that the software mixer. Capturing from the PCM software mixer reference device will give you the mixed audio stream from the application mixer stage. You cannot capture from the PCM software mixer reference if the PCM software mixer is not actively mixing audio streams.

If the PCM software mixer has not been disabled, requests are always automatically routed to the PCM software mixer. The functionality is enabled in the hardware device entry. It's important to note that a PCM Software mixer is always created for you, even if the hardware has multiple hardware subchannels. Even with only one stream, the CPU is used more than if the hardware device were used.

If playback is using the PCM software mixer, it's important that you know that the client application's fragment size can be any multiple of the PCM software mixer fragment size. If the PCM software mixer's fragment size is 4K, then the application's fragment can be a multiple of 4K. Here's how you calculate the fragment size for the client application or PCM software mixer:
fragment size (1024 samples per voice (channels) in this case) x 2 bytes per sample (16-bit)
                         x 2 channels
                         = 4096 bytes