2009/12/14 pl bossart bossart.nospam@gmail.com
For transfer purposes, one only needs to know that DMA transfer is complete on period X so that period X can now be over-written.
That's the 'traditional' view. ALSA is now used in different ways. PulseAudio sets a timer and relies on snd_pcm_avail() to query how many samples it can write to the ring buffer, the notion of period isn't used at all. I think we could use additional information in the way the hw_ptr position is reported, namely hints on how precise this information is and the granularity of the updates.
- Pierre
Pulseaudio need more than a timer and relies on snd_pcm_avail() to query how many samples it can write to the ring buffer,
Refer to http://0pointer.de/blog/projects/pulse-glitch-free.html
The third basic idea is to allow rewriting of the hardware buffer at any time. .
For example, If the playback position is 0, the hardware has probably already transferred one period of the sound card. So, one cannot write to playback position 2 and expect it to be output to the sound card if the period size is 1024
Using mmap only can allow writing of the hardware buffer at any time but rewriting of the hardware buffer depend on the two new function snd_pcm_rewind() and snd_pcm_rewindable()