From 61afe3820a9e967a471e6ef90162158f5cf87f39 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 11 Jul 2016 11:03:31 +0200 Subject: 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. --- audio/filter/af_volume.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'audio/filter') 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; } -- cgit v1.2.3