diff options
-rw-r--r-- | DOCS/man/options.rst | 10 | ||||
-rw-r--r-- | audio/filter/af_volume.c | 7 | ||||
-rw-r--r-- | options/options.c | 6 |
3 files changed, 13 insertions, 10 deletions
diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index a0b59059b6..726376e1a9 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -890,7 +890,8 @@ Audio .. note:: This was changed after the mpv 0.9 release. Before that, 100 actually - meant maximum volume. + meant maximum volume. At the same time, the volume scale was made cubic, + so the old values won't match up with the new ones anyway. ``--audio-delay=<sec>`` Audio delay in seconds (positive or negative float value). Positive values @@ -1059,10 +1060,9 @@ Audio their start timestamps differ, and then video timing is gradually adjusted if necessary to reach correct synchronization later. -``--softvol-max=<100.0-10000.0>`` - Set the maximum amplification level in percent (default: 200). A value of - 200 will allow you to adjust the volume up to a maximum of double the - current level. +``--softvol-max=<100.0-1000.0>`` + Set the maximum amplification level in percent (default: 130). A value of + 130 will allow you to adjust the volume up to about double the normal level. ``--audio-file-auto=<no|exact|fuzzy|all>``, ``--no-audio-file-auto`` Load additional audio files matching the video filename. The parameter 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; diff --git a/options/options.c b/options/options.c index dcd6167c4e..4c46c6f190 100644 --- a/options/options.c +++ b/options/options.c @@ -379,8 +379,8 @@ const m_option_t mp_opts[] = { ({"no", SOFTVOL_NO}, {"yes", SOFTVOL_YES}, {"auto", SOFTVOL_AUTO})), - OPT_FLOATRANGE("softvol-max", softvol_max, 0, 100, 10000), - OPT_FLOATRANGE("volume", mixer_init_volume, 0, -1, 10000), + OPT_FLOATRANGE("softvol-max", softvol_max, 0, 100, 1000), + OPT_FLOATRANGE("volume", mixer_init_volume, 0, -1, 1000), OPT_CHOICE("mute", mixer_init_mute, 0, ({"auto", -1}, {"no", 0}, @@ -644,7 +644,7 @@ const struct MPOpts mp_default_opts = { .video_decoders = NULL, .deinterlace = -1, .softvol = SOFTVOL_AUTO, - .softvol_max = 200, + .softvol_max = 130, .mixer_init_volume = -1, .mixer_init_mute = -1, .gapless_audio = -1, |