summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-07-11 11:03:31 +0200
committerwm4 <wm4@nowhere>2016-07-11 11:03:36 +0200
commit61afe3820a9e967a471e6ef90162158f5cf87f39 (patch)
tree1f119f8bc8bed12bd7b21f9b3549ebfdf1c47c4b
parent60048b7eb957bbe09b9c42d11ed61911939b0553 (diff)
downloadmpv-61afe3820a9e967a471e6ef90162158f5cf87f39.tar.bz2
mpv-61afe3820a9e967a471e6ef90162158f5cf87f39.tar.xz
af_volume: don't let softvol overwrite af_volume volumedb sub-option
af_volume has a volumedb sub-option, which allows the user to set an explicit volume. Until recently, the player read back this value and used it as initial softvol volume. But now it just overwrites it. Instead of overwriting it, multiply the different gain values. Above all, this will do the right thing if only softvol is used, or if the user only adds the af_volume filter manually.
-rw-r--r--audio/filter/af_volume.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/audio/filter/af_volume.c b/audio/filter/af_volume.c
index 7bd7edd66d..20031961b4 100644
--- a/audio/filter/af_volume.c
+++ b/audio/filter/af_volume.c
@@ -115,7 +115,7 @@ static void filter_plane(struct af_instance *af, struct mp_audio *data, int p)
{
struct priv *s = af->priv;
- float level = s->level * s->rgain;
+ float level = s->level * s->rgain * from_dB(s->cfg_volume, 20.0, -200.0, 60.0);
int num_samples = data->samples * data->spf;
if (af_fmt_from_planar(af->data->format) == AF_FORMAT_S16) {
@@ -158,7 +158,7 @@ static int af_open(struct af_instance *af)
struct priv *s = af->priv;
af->control = control;
af->filter_frame = filter;
- s->level = from_dB(s->cfg_volume, 20.0, -200.0, 60.0);
+ s->level = 1.0;
return AF_OK;
}