pa_sw_volume_from_linear is not the inverse of pa_sw_volume_to_linear
Summary
I expected these to be inverses, and the docs for pa_sw_volume_from_linear
state that,
* We make sure that the conversion to linear and back yields the
* same volume value! That's why we need the lround() below!
But it seems I'm getting some junk in the returned double value. In my applications unit tests, there is one that upon setting the volume to 0.5, expects the volume getter to also be 0.5, but because pa_sw_volume_to_linear(pa_sw_volume_from_linear(0.5)) != 0.5
, it fails. I could work around it in my application, but this seems like a bug? Or maybe it's a limitation of the integer volume code in PA?
environment
git HEAD
Steps to reproduce
I extracted the relevant bits out of PA in the test script attached.
What is the current bug behavior?
pa_sw_volume_to_linear(pa_sw_volume_from_linear(0.5)) = 0.500001
What is the expected correct behavior?
pa_sw_volume_to_linear(pa_sw_volume_from_linear(0.5)) = 0.5