Web lists-archives.com

Re: [MPlayer-dev-eng] [patch] gui ignores mplayer volume option




I wrote on Tue, 29 Jul 2014 23:56:55 +0200:

> In the meantime, I have a working solution for assigning the skin defaults
> [...], but it seems that there are some bugs with setting volume and/or
> balance (evSetVolume, evSetBalance, GUI_SET_VOLUME_BALANCE) in the Win32
> GUI (with dsound, at least).

BTW, this is what I have so far.

Ingo
Index: gui/win32/gui.h
===================================================================
--- gui/win32/gui.h	(revision 37243)
+++ gui/win32/gui.h	(working copy)
@@ -85,6 +85,9 @@
     int playlistwindow;
     int aboutwindow;
 
+    float default_volume;
+    float default_balance;
+
     skin_t *skin;
     playlist_t *playlist;
 
Index: gui/win32/gui.c
===================================================================
--- gui/win32/gui.c	(revision 37243)
+++ gui/win32/gui.c	(working copy)
@@ -237,6 +237,20 @@
     return -1;
 }
 
+static void get_widgetvalue(skin_t *skin, int event, float *value)
+{
+    unsigned int i;
+
+    if (!skin) return;
+
+    for (i=0; i<skin->widgetcount; i++)
+        if (skin->widgets[i]->msg == event)
+        {
+            *value = skin->widgets[i]->value;
+            return;
+        }
+}
+
 static void uninit(gui_t *gui)
 {
     if(gui->skin) destroy_window(gui);
@@ -1659,6 +1673,17 @@
     /* enable drag and drop support */
     DragAcceptFiles(gui->mainwindow, TRUE);
 
+    /* set defaults */
+    gui->default_volume = 50.0f;
+    gui->default_balance = 50.0f;
+
+    /* get defaults from skin */
+    get_widgetvalue(gui->skin, evSetVolume, &gui->default_volume);
+    get_widgetvalue(gui->skin, evSetBalance, &gui->default_balance);
+    get_widgetvalue(gui->skin, evSetMoviePosition, &guiInfo.Position);
+
+    if (guiInfo.Position) gui->playercontrol(evSetMoviePosition);
+
     updatedisplay(gui, gui->mainwindow);
 
     /* display */
Index: gui/win32/interface.c
===================================================================
--- gui/win32/interface.c	(revision 37243)
+++ gui/win32/interface.c	(working copy)
@@ -537,6 +537,9 @@
     /* Wait until the gui is created */
     while(!mygui) Sleep(100);
     mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] GUI thread started.\n");
+
+    guiInfo.Volume = mygui->default_volume;
+    guiInfo.Balance = mygui->default_balance;
 }
 
 void guiDone(void)
@@ -636,6 +639,8 @@
                 guiInfo.AudioChannels = 0;
                 guiInfo.AudioPassthrough = FALSE;
             }
+            guiSetEvent(evSetVolume);
+            guiSetEvent(evSetBalance);
             if(IsWindowVisible(mygui->videowindow) && !guiInfo.VideoWindow)
                 ShowWindow(mygui->videowindow, SW_HIDE);
             break;
_______________________________________________
MPlayer-dev-eng mailing list
MPlayer-dev-eng@xxxxxxxxxxxx
https://lists.mplayerhq.hu/mailman/listinfo/mplayer-dev-eng