Re: Vanilla Blocked I/O probs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux