snd_pcm_plugin_update_src()

Get the size of the next fragment to write (plugin-aware)

Synopsis:

#include <sys/asoundlib.h>

int snd_pcm_plugin_update_src(
       snd_pcm_t               *handle,
       snd_pcm_channel_setup_t *setup,
       int                      currlevel );

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().
setup
A pointer to a snd_pcm_channel_setup_t structure that snd_pcm_plugin_setup() fills with information about the current configuration of the PCM channel.
currlevel
The current level of client size buffering, in percent.

Library:

libasound.so

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

Description:

The snd_pcm_plugin_update_src() function returns the size of the next fragment required for snd_pcm_plugin_write().

If you're using SND_SRC_MODE_ACTUAL or SND_SRC_MODE_ASYNC mode (see snd_pcm_plugin_set_src_mode()), you need to call snd_pcm_plugin_update_src() after each call to snd_pcm_plugin_write().

The client is responsible for buffering an appropriate amount of data in order to not underflow the write calls. The client must determine the buffer fullness in percent (number of PCM samples the client is holding divided by the total buffer space available). The sample rate converter in libasound adjusts the sample rate converter to maintain a close tracking of the target (in percent) set in snd_pcm_plugin_update_src().

Returns:

The number of samples to write in the next snd_pcm_plugin_write() call, or -EINVAL if any of the arguments are invalid.

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.