Re: Reproducible pops on some hardware

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

 



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

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Alsa-user mailing list
Alsa-user@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/alsa-user


[Index of Archives]     [ALSA Devel]     [Linux Audio Users]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]

  Powered by Linux