[alsa-devel] Vanilla Blocked I/O probs
Gregor Jasny
jasny at vidsoft.de
Tue Apr 3 18:29:45 CEST 2007
Hi Gordon,
Gordon Miller schrieb:
> I went for this :
>
> /*******************************************************/
> void
> record_block (void *buffer)
> {
> int rc, needed = MAX_LEN;
> void *buf_ptr = buffer;
>
> do
> {
> rc = snd_pcm_readi (handle, buf_ptr, needed);
> needed -= rc;
> buf_ptr += rc * (stereo_channel ? BPSSTEREO : BPSMONO);
> }
> while (needed);
>
> } /* end record_block */
> /****************************************************/
You could also use:
if (rc > 0) {
needed -= rc;
buf_ptr += snd_pcm_frames_to_bytes( handle, rc );
}
Gregor
More information about the Alsa-devel
mailing list