diff options
Diffstat (limited to 'audio/mixer.c')
-rw-r--r-- | audio/mixer.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/audio/mixer.c b/audio/mixer.c index 26f426c2b4..3aa06f6c62 100644 --- a/audio/mixer.c +++ b/audio/mixer.c @@ -120,8 +120,11 @@ void mixer_getvolume(struct mixer *mixer, float *l, float *r) *r = mixer->vol_r; } -static void setvolume_internal(struct mixer *mixer, float l, float r) +static void setvolume_internal(struct mixer *mixer) { + float l = mixer->vol_l, r = mixer->vol_r; + if (mixer->emulate_mute && mixer->muted) + l = r = 0; if (!mixer->softvol) { MP_DBG(mixer, "Setting volume on AO.\n"); struct ao_control_vol vol = {.left = l, .right = r}; @@ -147,8 +150,8 @@ void mixer_setvolume(struct mixer *mixer, float l, float r) float max = mixer_getmaxvolume(mixer); mixer->vol_l = MPCLAMP(l, 0, max); mixer->vol_r = MPCLAMP(r, 0, max); - if (mixer->ao && !(mixer->emulate_mute && mixer->muted)) - setvolume_internal(mixer, mixer->vol_l, mixer->vol_r); + if (mixer->ao) + setvolume_internal(mixer); } void mixer_getbothvolume(struct mixer *mixer, float *b) @@ -167,7 +170,7 @@ void mixer_setmute(struct mixer *mixer, bool mute) mixer->muted = mute; mixer->muted_by_us = mute; if (mixer->emulate_mute) { - setvolume_internal(mixer, mixer->vol_l*!mute, mixer->vol_r*!mute); + setvolume_internal(mixer); } else { ao_control(mixer->ao, AOCONTROL_SET_MUTE, &mute); } |