summaryrefslogtreecommitdiffstats
path: root/mixer.h
diff options
context:
space:
mode:
authorwm4 <wm4@mplayer2.org>2011-12-22 07:02:19 +0100
committerwm4 <wm4@mplayer2.org>2012-01-07 16:42:30 +0100
commit685fbf25fecd13524b083f3b05264806d054f21d (patch)
treee37234f45176e0f262f82f591d1280150def86da /mixer.h
parent670e72506a652f1876da6063b3ca0d06ec545e76 (diff)
downloadmpv-685fbf25fecd13524b083f3b05264806d054f21d.tar.bz2
mpv-685fbf25fecd13524b083f3b05264806d054f21d.tar.xz
mixer: keep user volume setting when --softvol is used
When --softvol is enabled, the volume set by the "volume" property is reset when changing to a new file or crossing ordered chapter boundaries. Fix this by explicitly restoring the volume on audio reinitialization. Now the behavior with --softvol should be the same as if a system mixer is used, and the volume should be persistent across file changes. This also works around an inconsistency with the mute flag. The frontend assumed the mute flag is persistent across file changes, which was not true with --softvol. If not resetting the volume on playing new files is undesired, it can be avoided by putting volume=100 in the mplayer config file.
Diffstat (limited to 'mixer.h')
-rw-r--r--mixer.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/mixer.h b/mixer.h
index 23c7f3ade0..473933ecbe 100644
--- a/mixer.h
+++ b/mixer.h
@@ -33,8 +33,11 @@ typedef struct mixer_s {
int volstep;
int muted;
float last_l, last_r;
+ float softvol_l, softvol_r;
+ int restore_softvol;
} mixer_t;
+void mixer_reinit(mixer_t *mixer);
void mixer_getvolume(mixer_t *mixer, float *l, float *r);
void mixer_setvolume(mixer_t *mixer, float l, float r);
void mixer_incvolume(mixer_t *mixer);