Mercurial > mplayer.hg
comparison gui/interface.c @ 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 |
comparison
equal
deleted
inserted
replaced
33671:a460339acfdf | 33672:e576232a39d5 |
---|---|
685 break; | 685 break; |
686 | 686 |
687 case guiSetMixer: | 687 case guiSetMixer: |
688 if (mixer) { | 688 if (mixer) { |
689 float l, r; | 689 float l, r; |
690 static float last_balance = -1; | |
690 | 691 |
691 mixer_getvolume(mixer, &l, &r); | 692 mixer_getvolume(mixer, &l, &r); |
693 | |
692 guiInfo.Volume = FFMAX(l, r); | 694 guiInfo.Volume = FFMAX(l, r); |
693 | 695 btnModify(evSetVolume, guiInfo.Volume); |
696 | |
697 if (guiInfo.Balance != last_balance) { | |
694 if (guiInfo.Volume) | 698 if (guiInfo.Volume) |
695 guiInfo.Balance = ((r - l) / guiInfo.Volume + 1.0) * 50.0; | 699 guiInfo.Balance = ((r - l) / guiInfo.Volume + 1.0) * 50.0; |
696 else | 700 else |
697 guiInfo.Balance = 50.0f; | 701 guiInfo.Balance = 50.0f; |
698 | 702 |
699 btnModify(evSetVolume, guiInfo.Volume); | 703 last_balance = guiInfo.Balance; |
700 btnModify(evSetBalance, guiInfo.Balance); | 704 btnModify(evSetBalance, guiInfo.Balance); |
705 } | |
701 } | 706 } |
702 break; | 707 break; |
703 | 708 |
704 case guiSetVideo: | 709 case guiSetVideo: |
705 | 710 |