[MPlayer-cvslog] r33760 - trunk/gui/interface.c

ib subversion at mplayerhq.hu
Tue Jun 28 20:16:07 CEST 2011


Author: ib
Date: Tue Jun 28 20:16:06 2011
New Revision: 33760

Log:
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.

Modified:
   trunk/gui/interface.c

Modified: trunk/gui/interface.c
==============================================================================
--- trunk/gui/interface.c	Tue Jun 28 19:52:30 2011	(r33759)
+++ trunk/gui/interface.c	Tue Jun 28 20:16:06 2011	(r33760)
@@ -687,17 +687,22 @@ int guiGetEvent(int type, void *arg)
     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;
 


More information about the MPlayer-cvslog mailing list