On Wed, Feb 17, 2010 at 07:15:30PM +0100, Lennart Poettering wrote:
Now the question I have is, how should I best deal with this? I currently assume that mixer volume changes are basically instantaneous when I call the respective function of ALSA. But are they really? How big is the latency at max? Do we need an API to query it?
For the embedded case the hardware update should happen synchronously with the ALSA API call to adjust the setting and begin affecting the played audio instantaneously. The time taken to do the hardware update will be dominated by I/O costs, which will in turn depend on the bus used to access the codec - it'd be good if the buses could provide some information to ASoC to allow it to do an estimate, but at the minute we've got nothing really to go on.
What's more interesting from this point of view is that the update will affect the audio going through the chip at the current moment so there will be latency from the DMA chain and possibly also from the DSP chain within the CODEC (which may vary depending on which volume you're updating).
I suspect that trying to offer additional resolution in this way is more trouble than it's worth if you're concerned about the artifacts that are introduced during updates. Providing per-channel differentiation if the hardware has only mono control has much fewer problems, though.