[alsa-devel] Latency of mixer reconfiguration

Jaroslav Kysela perex at perex.cz
Fri Feb 19 10:01:26 CET 2010

On Thu, 18 Feb 2010, Lennart Poettering wrote:

> On Thu, 18.02.10 10:01, Mark Brown (broonie at opensource.wolfsonmicro.com) 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.
> But what would you guess? In which range will this most likely be? < 1ms?
> 1ms? 10ms? 100ms? 1s? 1h? 10h? 10d? 10y?

Some drivers uses a queue (like HDA) for serial bus to update the audio 
mixer registers. But anyway, the real write should take several ms for 
maximum (maybe more on USB bus).

> tbh I feared less the actually IO latency but more that some PCM data
> fifos might need flushing before the volume is actually updated. And
> the latency of those fifos I feared might be more than a handful of
> samples?

It's quite complex question and probably only hardware vendors knows 
these internals for all devices. I guess also, that some devices also uses 
volume ramping to avoid clicks.


Jaroslav Kysela <perex at perex.cz>
Linux Kernel Sound Maintainer
ALSA Project, Red Hat, Inc.

More information about the Alsa-devel mailing list