summaryrefslogtreecommitdiffstats
path: root/audio/filter/af_volume.c
diff options
context:
space:
mode:
Diffstat (limited to 'audio/filter/af_volume.c')
-rw-r--r--audio/filter/af_volume.c7
1 files changed, 5 insertions, 2 deletions
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;