diff options
author | wm4 <wm4@nowhere> | 2016-07-14 18:11:14 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-07-14 18:11:14 +0200 |
commit | d191d76e52a992840ab614f760f1189391a5507d (patch) | |
tree | 4f9fd9687eaa65b3156bedf0aefd98f52feed567 /audio | |
parent | f53d73b9dc373a41ab535b247f6a2178783b2b82 (diff) | |
download | mpv-d191d76e52a992840ab614f760f1189391a5507d.tar.bz2 mpv-d191d76e52a992840ab614f760f1189391a5507d.tar.xz |
ao_pulse: fix some volume control rounding issues
Volume could get easily "stuck" or making too huge steps when doing
things like "add ao-volume 1".
Diffstat (limited to 'audio')
-rw-r--r-- | audio/out/ao_pulse.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/audio/out/ao_pulse.c b/audio/out/ao_pulse.c index d553b6700c..fc0dd0d008 100644 --- a/audio/out/ao_pulse.c +++ b/audio/out/ao_pulse.c @@ -23,6 +23,7 @@ #include <stdbool.h> #include <string.h> #include <stdint.h> +#include <math.h> #include <pthread.h> #include <pulse/pulseaudio.h> @@ -34,8 +35,8 @@ #include "ao.h" #include "internal.h" -#define VOL_PA2MP(v) ((v) * 100 / PA_VOLUME_NORM) -#define VOL_MP2PA(v) ((v) * PA_VOLUME_NORM / 100) +#define VOL_PA2MP(v) ((v) * 100.0 / PA_VOLUME_NORM) +#define VOL_MP2PA(v) lrint((v) * PA_VOLUME_NORM / 100) struct priv { // PulseAudio playback stream object |