Play out all pending data in a PCM playback channel's queue and stop the channel
#include <sys/asoundlib.h> int snd_pcm_playback_flush( snd_pcm_t *handle);
The snd_pcm_playback_flush() function blocks until all unprocessed data in the driver queue has been played.
If the operation is successful (zero is returned), the channel's state is changed to SND_PCM_STATUS_READY and the channel is stopped.
Since this call is a blocking call, if the channel is in the SND_PCM_STATUS_SUSPENDED state an error occurs if you call this function. If you call this function while in the SND_PCM_STATUS_PAUSED state, playback is resumed and the channel goes into the SND_PCM_STATUS_RUNNING state immediately,and then ends in the SND_PCM_STATUS_READY state.
If the channel doesn't start playing (not enough data has been written to start playback), then this call silences the remainder of the buffer to satisfy the playback start requirements. Once the playback requirements are satisfied, playback starts and allows the data to be played out. Once the buffer empties, this call returns successfully.
If this call completes successfully, the channel is left in the SND_PCM_STATUS_READY state.
EOK on success, a negative errno upon failure. The errno values are available in the errno.h file.
QNX Neutrino
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | Yes |
Thread | Read the Caveats |
This function is not thread safe if handle (snd_pcm_t) is used across multiple threads.