diff options
author | wm4 <wm4@nowhere> | 2015-05-22 18:44:59 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-05-22 19:16:42 +0200 |
commit | a165a614150bb6482fe3804d845daa571ccba051 (patch) | |
tree | 31dca1c62b921f9b46d90220e1403e069f34fe13 /audio/filter | |
parent | 68bbab0e42e141896545f1f6e9699bcad2d685f8 (diff) | |
download | mpv-a165a614150bb6482fe3804d845daa571ccba051.tar.bz2 mpv-a165a614150bb6482fe3804d845daa571ccba051.tar.xz |
audio: make softvol scale cubic
This brings the volume control closer to what is percepted as linear
volume change.
Adjust the --softvol-max default to roughly the old maximum (roughly
doubles the gain).
Diffstat (limited to 'audio/filter')
-rw-r--r-- | audio/filter/af_volume.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/audio/filter/af_volume.c b/audio/filter/af_volume.c index a0b47e7438..dfdf586690 100644 --- a/audio/filter/af_volume.c +++ b/audio/filter/af_volume.c @@ -30,6 +30,7 @@ #include "demux/demux.h" struct priv { + float vol; // User-specified non-linear volume float level; // User-specified gain level for each channel float rgain; // Replaygain level int rgain_track; // Enable/disable track based replaygain @@ -87,10 +88,12 @@ static int control(struct af_instance *af, int cmd, void *arg) return af_test_output(af, in); } case AF_CONTROL_SET_VOLUME: - s->level = *(float *)arg; + s->vol = *(float *)arg; + s->level = pow(s->vol, 3); + MP_VERBOSE(af, "volume gain: %f\n", s->level); return AF_OK; case AF_CONTROL_GET_VOLUME: - *(float *)arg = s->level; + *(float *)arg = s->vol; return AF_OK; } return AF_UNKNOWN; |