Get the size of the next fragment to write (plugin-aware)
#include <sys/asoundlib.h> int snd_pcm_plugin_update_src( snd_pcm_t *handle, snd_pcm_channel_setup_t *setup, int currlevel );
- The handle for the PCM device, which you must have opened by calling snd_pcm_open() or snd_pcm_open_preferred() .
- 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.
- The current level of client size buffering, in percent.
Use the -l asound option to qcc to link against this library.
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().
The number of samples to write in the next snd_pcm_plugin_write() call, or -EINVAL if any of the arguments are invalid.
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.