Transfer PCM stream to playback subdevice
#include <sys/asoundlib.h>
ssize_t snd_pcm_plugin_write( snd_pcm_t * handle,
const void * buffer,
size_t size );
libasound.so
The snd_pcm_plugin_write() function
writes samples that's in the proper format to the device specified by
snd_pcm_plugin_prepare().
- -EAGAIN
- Try again later. The subchannel is opened nonblock (block and stream mode),
or is in paused state (block mode).
- -EINVAL
- The channel isn't in the prepared or running state.
In block mode: count isn't an even multiple of setup ->buf.block.frag_size.
In stream mode: the format is set as interleaved (not allowed).
- -EIO
- Invalid mode (valid modes include: SND_PCM_MODE_BLOCK and SND_PCM_MODE_STREAM).
In block mode: no space in buffers and subchannel isn't running, or
the subchannel isn't in the prepared or running state.
In stream mode: underrun.
- -EWOULDBLOCK
- Write would have blocked (nonblocking write).
See the example in
Handling writes
in the Playing audio data chapter.
ALSA
Safety: | |
Cancellation point |
No |
Interrupt handler |
No |
Signal handler |
Yes |
Thread |
Yes |
snd_pcm_plugin_prepare()