diff options
author | Lennart Poettering <lennart@poettering.net> | 2009-08-14 20:03:30 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2009-08-14 20:03:30 +0200 |
commit | 0f2a4ed422530b56b3744efe8055540644c0e774 (patch) | |
tree | 4236f23bd76f445b8d7119de0c9e30471673daa5 /src/pulse | |
parent | 72d2540e8dc47e101ac9d5ae24eee1b95e8dbcfa (diff) |
volume: guarantee dB/linear conversion is reversible
Diffstat (limited to 'src/pulse')
-rw-r--r-- | src/pulse/volume.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/pulse/volume.c b/src/pulse/volume.c index 42cde5b9..c23f360b 100644 --- a/src/pulse/volume.c +++ b/src/pulse/volume.c @@ -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) { |