summaryrefslogtreecommitdiffstats
path: root/mixer.h
diff options
context:
space:
mode:
authorwm4 <wm4@mplayer2.org>2012-01-07 18:06:30 +0100
committerwm4 <wm4@mplayer2.org>2012-01-18 04:21:45 +0100
commitb338b16be7fe902723fc9c5c20f88959264e67d7 (patch)
tree0fc7f4f90430e1a73a977f1932ea541244115725 /mixer.h
parent6afaf948cd80e348c4ff93f44baae362d4423793 (diff)
downloadmpv-b338b16be7fe902723fc9c5c20f88959264e67d7.tar.bz2
mpv-b338b16be7fe902723fc9c5c20f88959264e67d7.tar.xz
audio: reset mplayer's mute state when the system mixer volume changes
Before this commit, the mute state was only reset when either mute was explicitly cleared, or the volume was changed via mplayer controls. If the volume controls are connected to the system mixer, and the system mixer volume is changed otherwise (e.g. with alsamixer), the mute setting was inconsistent. Avoid this by checking the volume. If the returned volume is not 0, the mute flag is considered invalid. This relies on system mixers always returning a volume of 0 when mplayer has set the volume 0. Possible caveat: if the audio output's volume control don't return a volume of exactly 0 after 0 was written, enabling mute basically won't work. It will set the volume to silence, forget the previous volume, and report that mute is disabled.
Diffstat (limited to 'mixer.h')
-rw-r--r--mixer.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/mixer.h b/mixer.h
index f05688bc72..f99e860ff3 100644
--- a/mixer.h
+++ b/mixer.h
@@ -33,7 +33,7 @@ typedef struct mixer_s {
struct ao *ao;
af_stream_t *afilter;
int volstep;
- int muted;
+ bool muted;
float last_l, last_r;
float restore_vol_l, restore_vol_r;
bool restore_volume;
@@ -49,6 +49,7 @@ void mixer_incvolume(mixer_t *mixer);
void mixer_decvolume(mixer_t *mixer);
void mixer_getbothvolume(mixer_t *mixer, float *b);
void mixer_mute(mixer_t *mixer);
+bool mixer_getmuted(mixer_t *mixer);
void mixer_setmuted(mixer_t *mixer, bool mute);
void mixer_getbalance(mixer_t *mixer, float *bal);
void mixer_setbalance(mixer_t *mixer, float bal);