Re: [Alsa-user] Reproducible pops on some hardware
Brought to you by:
perex
From: Clemens L. <cla...@go...> - 2012-06-27 20:07:52
|
Bryan Ischo wrote: > OK I think I figured out a way: This is how mplayer does it. > Immediately after preparing a PCM device, and before doing any writes to > it, I call snd_pcm_avail() and record that number (in my case, it is > 16384) as "maxValidAvail". This is the buffer size. > Immediately before any call to snd_pcm_writei(), I again call > snd_pcm_avail(). If the result is greater than maxValidAvail, I call > snd_pcm_forward(pcm, snd_pcm_avail() - maxValidAvail). > > I *think* that what this accomplishes is to forward the write pointer > within the ring buffer to the read pointer. Yes. (And the read pointer continues to move, so you'll have to write really fast.) > I don't really understand why snd_pcm_avail() goes greater than the ring > buffer size when silence has been played out It's the number of frames you have to write to completely fill up the buffer. Regards, Clemens |