Mercurial > mplayer.hg
changeset 33672:e576232a39d5
Prevent balance from hopping.
Only recalculate the balance if the balance has changed, not if just
the volume has changed.
Because (at least with my soundcard) not all volume values can be
stored, but seem to be mapped onto a discrete value set, recalculation
the balance from the volume isn't accurate enough.
author | ib |
---|---|
date | Tue, 28 Jun 2011 18:16:06 +0000 |
parents | a460339acfdf |
children | 38c765585fe5 |
files | gui/interface.c |
diffstat | 1 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/gui/interface.c Tue Jun 28 17:52:30 2011 +0000 +++ b/gui/interface.c Tue Jun 28 18:16:06 2011 +0000 @@ -687,17 +687,22 @@ case guiSetMixer: if (mixer) { float l, r; + static float last_balance = -1; mixer_getvolume(mixer, &l, &r); + guiInfo.Volume = FFMAX(l, r); + btnModify(evSetVolume, guiInfo.Volume); + if (guiInfo.Balance != last_balance) { if (guiInfo.Volume) guiInfo.Balance = ((r - l) / guiInfo.Volume + 1.0) * 50.0; else guiInfo.Balance = 50.0f; - btnModify(evSetVolume, guiInfo.Volume); + last_balance = guiInfo.Balance; btnModify(evSetBalance, guiInfo.Balance); + } } break;