PCM plugin converters

In some cases, an application has data in one form, 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 conversation is accomplished by invoking a series of plugin converters, each capable of doing a very specific job. As an 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.

The minimum number of converters is invoked to translate the input format to the output format so as to minimize CPU usage. 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);
Note: Don't mix the plugin API functions with the nonplugin functions.