Writes samples to the device which must be in the proper format specified by snd_pcm_channel_prepare function. Function returns positive value if playback was successful (value represents count of bytes which were successfully written to device) or an error value if an error occurred. If the subdevice has the queue full, -EAGAIN result code is returned. Function will suspend process if block behaviour (see to snd_pcm_nonblock_mode) is active.
When the subdevice is in the block mode (SND_PCM_MODE_BLOCK), then the count of written bytes must fulfil the N * fragment size expression, where N is greater than zero. If the stream format is non-interleaved (the member interleave from the snd_pcm_format_t structure is not set), then the driver expects that data in one fragment is separated to single voice blocks. Lets imagine that we have two voices and the fragment size is 512 bytes. The number of bytes per one voice is 256. The driver expects that the first 256 bytes contain samples for the first voice and the second 256 bytes from fragment contain samples for the second voice.
When the subdevice is in the stream mode (SND_PCM_MODE_STREAM), then the interleaved stream mode is only accepted. You have to use snd_pcm_writev to perform writting for non-interleaved streams.