changeset 35542:fdaab02e7118

Set volume in GUI_SET_MIXER. This in missing in r35631.
author ib
date Sun, 09 Dec 2012 14:41:24 +0000
parents ded4a8c2aa70
children 5289e495e70e
files gui/interface.c
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/gui/interface.c	Sun Dec 09 13:19:42 2012 +0000
+++ b/gui/interface.c	Sun Dec 09 14:41:24 2012 +0000
@@ -751,6 +751,7 @@
 
         if (mixer) {
             float l, r, b;
+            static float last_balance = 50.0f;
 
             mixer_getvolume(mixer, &l, &r);
             guiInfo.Volume = FFMAX(l, r);
@@ -758,7 +759,14 @@
 
             mixer_getbalance(mixer, &b);
             guiInfo.Balance = (b + 1.0) * 50.0;
-            btnModify(evSetBalance, guiInfo.Balance);
+
+            if (guiInfo.Balance != last_balance) {
+                l = guiInfo.Volume * (100.0 - guiInfo.Balance) / 50.0;
+                r = guiInfo.Volume * guiInfo.Balance / 50.0;
+                mixer_setvolume(mixer, FFMIN(l, guiInfo.Volume), FFMIN(r, guiInfo.Volume));
+                btnModify(evSetBalance, guiInfo.Balance);
+                last_balance = guiInfo.Balance;
+            }
         }
 
         break;