[alsa-devel] Help

Jaroslav Kysela perex at perex.cz
Fri Apr 24 13:39:48 CEST 2009


On Fri, 24 Apr 2009, Sudeept Prusti wrote:

> Hi all,
>
> As i am working on alsa for minimal PCM playback (8khz,mono,16 bit pcm 
> file).
>
> When i tried to allocate 1k buffer and send through snd_pcm_writei() 
> call it doesn't play perfect and skips are there in between. If we keep 
> on increasing in allocating the buffer for 31 kb then it could play the 
> buffers randomly.

Sure. Your file read logic is broken. You have to check number of bytes 
read and do not assume that 'k' bytes were read all time. Also, using seek 
is not necessary for sequential reads.

 						Jaroslav

-----
Jaroslav Kysela <perex at perex.cz>
Linux Kernel Sound Maintainer
ALSA Project, Red Hat, Inc.



More information about the Alsa-devel mailing list