mirror of
https://github.com/mpv-player/mpv
synced 2025-02-19 06:17:00 +00:00
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).
This commit is contained in:
parent
68bbab0e42
commit
a165a61415
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user