mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-05 13:29:57 -05:00
volume: guarantee dB/linear conversion is reversible
This commit is contained in:
parent
72d2540e8d
commit
0f2a4ed422
2 changed files with 40 additions and 1 deletions
|
|
@ -205,9 +205,12 @@ pa_volume_t pa_sw_volume_from_linear(double v) {
|
|||
*
|
||||
* http://www.robotplanet.dk/audio/audio_gui_design/
|
||||
* http://lists.linuxaudio.org/pipermail/linux-audio-dev/2009-May/thread.html#23151
|
||||
*
|
||||
* We make sure that the conversion to linear and back yields the
|
||||
* same volume value! That's why we need the lround() below!
|
||||
*/
|
||||
|
||||
return (pa_volume_t) (cbrt(v) * PA_VOLUME_NORM);
|
||||
return (pa_volume_t) lround(cbrt(v) * PA_VOLUME_NORM);
|
||||
}
|
||||
|
||||
double pa_sw_volume_to_linear(pa_volume_t v) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue