- snd_pcm_sframes_t pcm_written_frames;
- int err;
-
- pcm_written_frames = snd_pcm_writei(pcm,
- playing->buffer + playing->start,
- avail_frames);
- D(("actually play %zu frames, wrote %d",
- avail_frames, (int)pcm_written_frames));
- if(pcm_written_frames < 0) {
- switch(pcm_written_frames) {
- case -EPIPE: /* underrun */
- error(0, "snd_pcm_writei reports underrun");
- if((err = snd_pcm_prepare(pcm)) < 0)
- fatal(0, "error calling snd_pcm_prepare: %d", err);
- return;
- case -EAGAIN:
- return;
- default:
- fatal(0, "error calling snd_pcm_writei: %d",
- (int)pcm_written_frames);
- }
- }
- written_frames = pcm_written_frames;
- written_bytes = written_frames * bpf;