mixer: keep balance setting

Similarly to the last commit, restore the balance setting when switching
to a new file. Unlike the volume setting, balance is always implemented
as filter, so this affects usage without --softvol too.
This commit is contained in:
wm4 2011-12-22 07:19:43 +01:00
parent 685fbf25fe
commit 7e3a4578bd
2 changed files with 8 additions and 0 deletions

View File

@ -43,6 +43,9 @@ void mixer_reinit(mixer_t *mixer)
mixer_setvolume(mixer, mixer->softvol_l, mixer->softvol_r);
mixer->muted = muted;
}
if (mixer->balance != 0) {
mixer_setbalance(mixer, mixer->balance);
}
}
void mixer_getvolume(mixer_t *mixer, float *l, float *r)
@ -176,6 +179,9 @@ void mixer_setbalance(mixer_t *mixer, float val)
if (!mixer->afilter)
return;
mixer->balance = val;
if (af_control_any_rev(mixer->afilter,
AF_CONTROL_PAN_BALANCE | AF_CONTROL_SET, &val))
return;
@ -183,6 +189,7 @@ void mixer_setbalance(mixer_t *mixer, float val)
if (!(af_pan_balance = af_add(mixer->afilter, "pan"))) {
mp_tmsg(MSGT_GLOBAL, MSGL_ERR,
"[Mixer] No balance control available.\n");
mixer->balance = 0;
return;
}

View File

@ -35,6 +35,7 @@ typedef struct mixer_s {
float last_l, last_r;
float softvol_l, softvol_r;
int restore_softvol;
float balance;
} mixer_t;
void mixer_reinit(mixer_t *mixer);