From 4ba52a9e821486d9d9b076a5187583af144b8cec Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 19 Sep 2013 14:31:55 +0200 Subject: mixer, af_volume: use linear values instead of dB Softvol always used a linear multiplier for volume control. This was converted to dB, and then back to linear in af_volume. Remove this non- sense. We still try to keep the command line argument to af_volume in dB, though. --- audio/filter/af_volume.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'audio/filter/af_volume.c') diff --git a/audio/filter/af_volume.c b/audio/filter/af_volume.c index 82c31eaa12..a766b97ec6 100644 --- a/audio/filter/af_volume.c +++ b/audio/filter/af_volume.c @@ -81,17 +81,22 @@ static int control(struct af_instance* af, int cmd, void* arg) } return af_test_output(af,(struct mp_audio*)arg); case AF_CONTROL_COMMAND_LINE:{ - float v=0.0; + float v=1000.0; float vol[AF_NCH]; int i; sscanf((char*)arg,"%f:%i:%i", &v, &s->soft, &s->fast); - for(i=0;ilevel,20.0,-200.0,60.0); + memcpy(s->level, arg, sizeof(float) * AF_NCH); + return AF_OK; case AF_CONTROL_VOLUME_LEVEL | AF_CONTROL_GET: - return af_to_dB(AF_NCH,s->level,(float*)arg,20.0); + memcpy(arg, s->level, sizeof(float) * AF_NCH); + return AF_OK; case AF_CONTROL_PRE_DESTROY:{ float m = 0.0; int i; -- cgit v1.2.3