comparison gui/interface.c @ 33671:a460339acfdf

Fix volume and balance bug. Changing the volume changed the balance as well, because the calculation for the balance was wrong. Additionally, use macro FFMAX() and replace identical code by a call to existing code.
author ib
date Tue, 28 Jun 2011 17:52:30 +0000
parents 3b3e2d2f68c3
children e576232a39d5
comparison
equal deleted inserted replaced
33670:3b3e2d2f68c3 33671:a460339acfdf
687 case guiSetMixer: 687 case guiSetMixer:
688 if (mixer) { 688 if (mixer) {
689 float l, r; 689 float l, r;
690 690
691 mixer_getvolume(mixer, &l, &r); 691 mixer_getvolume(mixer, &l, &r);
692 guiInfo.Volume = (r > l ? r : l); 692 guiInfo.Volume = FFMAX(l, r);
693 693
694 if (r != l) 694 if (guiInfo.Volume)
695 guiInfo.Balance = ((r - l) + 100) * 0.5f; 695 guiInfo.Balance = ((r - l) / guiInfo.Volume + 1.0) * 50.0;
696 else 696 else
697 guiInfo.Balance = 50.0f; 697 guiInfo.Balance = 50.0f;
698 698
699 btnModify(evSetVolume, guiInfo.Volume); 699 btnModify(evSetVolume, guiInfo.Volume);
700 btnModify(evSetBalance, guiInfo.Balance); 700 btnModify(evSetBalance, guiInfo.Balance);
717 else 717 else
718 btnSet(evSetMoviePosition, btnReleased); 718 btnSet(evSetMoviePosition, btnReleased);
719 719
720 // audio 720 // audio
721 721
722 if (mixer) { 722 guiGetEvent(guiSetMixer, NULL);
723 float l, r;
724
725 mixer_getvolume(mixer, &l, &r);
726 guiInfo.Volume = (r > l ? r : l);
727
728 if (r != l)
729 guiInfo.Balance = ((r - l) + 100) * 0.5f;
730 else
731 guiInfo.Balance = 50.0f;
732
733 btnModify(evSetVolume, guiInfo.Volume);
734 btnModify(evSetBalance, guiInfo.Balance);
735 }
736 723
737 if (gtkEnableAudioEqualizer) { 724 if (gtkEnableAudioEqualizer) {
738 equalizer_t eq; 725 equalizer_t eq;
739 int i, j; 726 int i, j;
740 727