Rockbox

Tasklist

FS#7441 - Volume is not correctly computed when using %?pv instead of %pv

Attached to Project: Rockbox
Opened by Raúl Núñez de Arenas Coronado (DervishD) - Sunday, 15 July 2007, 16:06 GMT
Last edited by Nicolas Pennequin (nicolas_p) - Monday, 23 July 2007, 17:11 GMT
Task Type Bugs
Category Themes
Status Closed
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version Daily build (which?)
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

The volume is not "translated" correctly if you use %?pv. The current formula, obtained from the source code, is:

(Number of slots in conditional - 3) * (volume - MAXVOLUME)
----------------------------------------------------------- + 2
MAXVOLUME - MINVOLUME


Since any level above 0dB is forced to use the last slot in the conditional, 0dB is forced to use the next-to-last and MINVOLUME is forced to use slot 1, the formula is not right. For example, the iAudioX5 has MAXVOLUME 6, MINVOLUME -73, so the formula will be:

(N-3) * (vol + 73)
------------------ +2
79

Thus, if N=80 (for 1:1 correspondence between different dB values including 0 and slots), the max slot used will be:

77 * (72)
--------- + 2 = 72, and it should be 78
79

If we take into account the "forced" slots, then N=75, and the max slot used will be:

72 * (72)
--------- + 2 = 67, and it should be 73
79

A correct formula can be this:

(N-3) * (vol - MIN - 1)
----------------------- + 2
-1 - MIN

Any other formula in the form y=mx+b can be used to map the dB values to the slots in the conditional, as long as m is calculated as "Number of slots in the conditional - 3) / (real dB steps to map, ignoring the forced values that won't be EVER mapped by this function)". The one presented above is the first I've thought of, and of course it can be improved so it is computed faster. I have a quick'n'dirty test that shows the mappings for an iAUDIO, written in shell script (ouch!).

Please contact me if you want a patch instead of this.
Raúl Núñez de Arenas Coronado
This task depends upon

Closed by  Nicolas Pennequin (nicolas_p)
Monday, 23 July 2007, 17:11 GMT
Reason for closing:  Fixed
Additional comments about closing:  The proposed fix is in SVN. Thanks for the detailed report :)

Loading...