changeset 35537:82f34397ebdb

Fix bug with wrong balance calculation. Moreover, a change in balance by MPlayer was not displayed.
author ib
date Sun, 09 Dec 2012 12:28:21 +0000
parents 1c2cb32a4af9
children 68a63175f140
files gui/interface.c
diffstat 1 files changed, 3 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/gui/interface.c	Sun Dec 09 12:23:56 2012 +0000
+++ b/gui/interface.c	Sun Dec 09 12:28:21 2012 +0000
@@ -742,23 +742,15 @@
             mixer = mpctx_get_mixer(guiInfo.mpcontext);
 
         if (mixer) {
-            float l, r;
-            static float last_balance = -1;
+            float l, r, b;
 
             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;
-
-                last_balance = guiInfo.Balance;
+            mixer_getbalance(mixer, &b);
+            guiInfo.Balance = (b + 1.0) * 50.0;
                 btnModify(evSetBalance, guiInfo.Balance);
-            }
         }
         break;