snd_pcm_plugin_set_src_mode()

Updated: April 19, 2023

Set the system's source mode (plugin-aware)

Synopsis:

#include <sys/asoundlib.h>

unsigned int snd_pcm_plugin_set_src_mode(
                snd_pcm_t    *handle,
                unsigned int  src_mode,
                int            target );

Arguments:

handle
The handle for the PCM device, which you must have opened by calling snd_pcm_open_name(), snd_pcm_open(), or snd_pcm_open_preferred().
src_mode
The sample rate conversion mode; one of the following:
  • SND_SRC_MODE_NORMAL — (default mode; all previous version of SRC work this way) SRC ratio based on input/output block size rounded towards zero. Floor(input size/output size).
  • SND_SRC_MODE_ACTUAL — fixed SRC which adjusts the input fragment size dynamically to prevent roundoff error from adjusting the playback speed.
  • SND_SRC_MODE_ASYNC — asynchronous SRC which adjusts the input fragment size to maintain a specified buffer fullness.
target
The level in percent for the buffer fullness measurement used in the asynchronous sample rate conversion.

Library:

libasound.so

Use the -l asound option with qcc to link against this library.

Description:

The snd_pcm_plugin_set_src_mode() function sets the type of sample rate conversion to use. Only playback modes are supported.

Returns:

The source mode (also in handle->plugin_src_mode) that the system is set to.

Classification:

QNX Neutrino

Safety:  
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Read the Caveats

Caveats:

This function is not thread safe if handle (snd_pcm_t) is used across multiple threads.

Make sure that you don't mix and match plugin- and nonplugin-aware functions in your application, or you may get undefined behavior and misleading results.