[alsa-devel] Mixer volume/decibel mapping
peter.ujfalusi at nokia.com
Fri May 21 08:51:36 CEST 2010
On Friday 21 May 2010 09:35:31 ext Clemens Ladisch wrote:
> James Courtier-Dutton wrote:
> > I believe it could be extended to support a continuous range.
> > For example, some hardware uses a 32bit value to control the gain.
> > The mix operation is simply "the_sample" * "the_control_value".
> > So in this case the hardware has a linear control that can be
> > considered continuous for our purposes.
> Such controls already exist:
> $ grep -rl DB_LINEAR sound/
The DB_SCALE also provides linear mapping:
For example, if the HW volume control has a range 0 .. 100
In HW these means:
0 == -10dB, 1 == -9.8dB, 2 == -9.6dB .. 99 = 9.8dB, 100 = 10dB
So it is linear.
#define TLV_DB_LINEAR_ITEM(min_dB, max_dB)
#define TLV_DB_SCALE_ITEM(min, step, mute)
TLV_DB_LINEAR_ITEM(-1000, 1000); is essentially the same as
TLV_DB_SCALE_ITEM(-1000, 20, 0);
In this case
In linear, you specify the min, and max dB. The control provides the range
(steps) in between the two ends.
In scale, you specify the minimum, and the steps for each control step.
At the end both are linear, and gives you exactly the same volume/dB pair.
> > The conversion from the control value to a usable value would have to
> > include a user land log operation.
> > It was never implemented due to lack of demand.
> It is implemented.
> > For the cards that do have this 32bit linear value, a simple lookup
> > table is used in the kernel code to convert it to 256 step values.
> Which driver is this? It should be changed to use the full range.
> Alsa-devel mailing list
> Alsa-devel at alsa-project.org
More information about the Alsa-devel