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

ib subversion at mplayerhq.hu
Tue Jun 28 19:52:31 CEST 2011


Author: ib
Date: Tue Jun 28 19:52:30 2011
New Revision: 33759

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

Modified:
   trunk/gui/interface.c

Modified: trunk/gui/interface.c
==============================================================================
--- trunk/gui/interface.c	Tue Jun 28 19:36:19 2011	(r33758)
+++ trunk/gui/interface.c	Tue Jun 28 19:52:30 2011	(r33759)
@@ -689,10 +689,10 @@ int guiGetEvent(int type, void *arg)
             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 @@ int guiGetEvent(int type, void *arg)
 
         // 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;


More information about the MPlayer-cvslog mailing list