On Fri 11 Jan 2008 10:01, Joachim Foerster pondered:
My only question is - if you allow a mmaped intermediate buffer, how does the driver notice when ALSA writes into this buffer?
It's the ack() callback. ALSA writes/reads something into/from the intermediate buffer and calls the driver's ack() callback - if there is any. In the ack() callback the driver should call one of the snd_pcm_indirect_*_transfer() functions. There, the difference between current and last seen appl_ptr gives the "new position" of the PCM Layer in your intermediate buffer (where it will write/read next time).
OK - thanks.
From just thinking about it - won't this will cause problems for things that need to understand where the audio device is in the PCM stream (like AEC, and lip-sync)? Since now everything from userspace is in reference to the position in the intermediate buffer - rather than what is actually coming out the DACs?