In some cases, an application has data in one format, and the PCM device is capable of accepting data only in another format. Clearly this won't work unless something is done. The application — like some MPG decoders — could reformat its data on the fly to a format that the device accepts. Alternatively, the application can ask QSA to do the conversion for it.
The format conversion is accomplished by invoking a series of plugin converters, each capable of doing a very specific job. For example, the rate converter converts a stream from one sampling frequency to another. There are plugin converters for bit conversions (8-to-16-bit, etc.), endian conversion (little endian to big endian and vice versa), voice conversions (stereo to mono, etc.) and so on.
To minimize CPU usage, the minimum number of converters is invoked to translate the input format to the output format. An application signals its willingness to use the plugin converter interface by using the PCM plugin API functions. These API functions all have plugin in their names. For more information, see the Audio Library chapter.
The ability to convert audio to match hardware capabilities (for example, voice conversion, rate conversion, type conversion, etc.) is enabled by default. This impacts the functions snd_pcm_channel_params(), snd_pcm_channel_setup(), and snd_pcm_channel_status(). These behave as snd_pcm_plugin_params(), snd_pcm_plugin_setup(), and snd_pcm_plugin_status(), unless you've disabled the conversion by calling:
snd_pcm_plugin_set_disable(handle, PLUGIN_CONVERSION);
Because the polyphase SRC plugin converter provides the best quality rate conversion with the least amount of CPU usage, QSA always tries to use it as the source filter method, regardless of the filter set using snd_pcm_plugin_set_src_method().
If the client requests a conversion that is not supported, QSA uses one of the other supported SRC methods (set using snd_pcm_plugin_set_src_method()), which support any sample rate conversion but may produce lower-quality conversions or use more CPU resources.
QSA also uses one of the other SRC methods if asynchronous SRC is enabled (set using snd_pcm_plugin_set_src_mode()).