Rockbox mail archive
Subject: auto-volume / thoughts on peak meter
auto-volume / thoughts on peak meter
> I've been thinking about how to make a better "auto-volume" feature.
>Its not yet evident where the best place to put the hooks to do this,
> but it doesn't seem like it would be hard to hack-in as an experiment.
The simplest way to hook something in for a quick test would be to use the
existing code of the peak meter. I'd recommend to hook into the function
peak_meter_peek. Drawback is that the code is only called when the peak
meter is turned on in wps. But we mustn't spread mas peak reads across the
code as each peak read 'resets' the peak register in the hardware. If the
peak meter and auto volume code read out the mas in an interleaved way
they'd 'reset' each others peak values. Thus it's preferable to centralize
the mas peak register access.
In the long run I think we should change the peak meter architecture. With
the peak meter and triggered recording we already have two completely
independent tasks that are based on volume information. I wouldn't be
surprised if - next to auto volume - others followed (e.g. auto gain
recording). These tasks are completely independent, rely on the same data
source and can be toggled on/of independently. Thus I think what we really
need is something like a listener list.
A centralized function would read the current volume values and send them to
each of the listeners. Depending on the hardware this function would be
called by the software codec or by a thread that reads the volume info from
Each of the modules Peak meter / trigger / auto-volume could register a
callback function in that list. In these callback functions the modules
could generate their statistical data (e.g. max values for the peak meter,
states of the trigger, avarage volume for auto-volume). Modules that aren't
in operation can unregister their listeners to save performance.
That all is a bit problematic as it is code that is executed very
frequently. The worst case are software codecs as here the code would be
executed for each single sample.
Received on Wed May 11 10:43:18 2005
Page was last modified "Jan 10 2012" The Rockbox Crew