# HG changeset patch # User ib # Date 1309283550 0 # Node ID a460339acfdf2607b96a6541ac5e742fcd5a9e16 # Parent 3b3e2d2f68c323b6a358a2cedece186924aeb9f7 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. diff -r 3b3e2d2f68c3 -r a460339acfdf gui/interface.c --- a/gui/interface.c Tue Jun 28 17:36:19 2011 +0000 +++ b/gui/interface.c Tue Jun 28 17:52:30 2011 +0000 @@ -689,10 +689,10 @@ float l, r; mixer_getvolume(mixer, &l, &r); - guiInfo.Volume = (r > l ? r : l); + guiInfo.Volume = FFMAX(l, r); - if (r != l) - guiInfo.Balance = ((r - l) + 100) * 0.5f; + if (guiInfo.Volume) + guiInfo.Balance = ((r - l) / guiInfo.Volume + 1.0) * 50.0; else guiInfo.Balance = 50.0f; @@ -719,20 +719,7 @@ // audio - if (mixer) { - float l, r; - - mixer_getvolume(mixer, &l, &r); - guiInfo.Volume = (r > l ? r : l); - - if (r != l) - guiInfo.Balance = ((r - l) + 100) * 0.5f; - else - guiInfo.Balance = 50.0f; - - btnModify(evSetVolume, guiInfo.Volume); - btnModify(evSetBalance, guiInfo.Balance); - } + guiGetEvent(guiSetMixer, NULL); if (gtkEnableAudioEqualizer) { equalizer_t eq;