[WINECFG] add configure audio driver button

Robert Reif reif at earthlink.net
Tue Jun 28 06:48:12 CDT 2005


- Add an audio configure button with code to display the selected
audio driver's configure dialog.
- Add an audio control panel launch button.

Currently wine audio drivers don't support being opened more
than once which prevents the configure dialogs from being
displayed.  Even if they were displayed, wine doesn't implement
any configuration options in the dialogs yet.  This feature in
necessary to configure individual drivers with driver specific
options.

Currently wine doesn't have an audio control panel applet.
Wine doesn't support creating and executing builtin control
panel applets but does support native ones.  There is no code
to execute the control panel yet.  This feature is necessary to
configure user preferences for a default audio and voice device.
-------------- next part --------------
Index: programs/winecfg/En.rc
===================================================================
RCS file: /home/wine/wine/programs/winecfg/En.rc,v
retrieving revision 1.41
diff -p -u -r1.41 En.rc
--- programs/winecfg/En.rc	19 May 2005 11:14:52 -0000	1.41
+++ programs/winecfg/En.rc	28 Jun 2005 11:30:13 -0000
@@ -139,6 +139,8 @@ BEGIN
     LTEXT	"Audio driver: ",IDC_STATIC,10,20,60,8
     COMBOBOX	IDC_AUDIO_DRIVER,70,18,85,85,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
     PUSHBUTTON	"Autodetect",IDC_AUDIO_AUTODETECT,170,20,49,14
+    PUSHBUTTON	"Configure",IDC_AUDIO_CONFIGURE,170,40,49,14
+    PUSHBUTTON	"Control Panel",IDC_AUDIO_CONTROL_PANEL,170,60,49,14
 END
 
 STRINGTABLE DISCARDABLE
Index: programs/winecfg/Makefile.in
===================================================================
RCS file: /home/wine/wine/programs/winecfg/Makefile.in,v
retrieving revision 1.13
diff -p -u -r1.13 Makefile.in
--- programs/winecfg/Makefile.in	9 Mar 2005 16:41:30 -0000	1.13
+++ programs/winecfg/Makefile.in	28 Jun 2005 11:30:13 -0000
@@ -4,7 +4,7 @@ SRCDIR    = @srcdir@
 VPATH     = @srcdir@
 MODULE    = winecfg.exe
 APPMODE   = -mwindows
-IMPORTS   = comdlg32 comctl32 shell32 ole32 shlwapi user32 advapi32 kernel32
+IMPORTS   = comdlg32 comctl32 shell32 ole32 shlwapi user32 advapi32 kernel32 winmm
 
 C_SRCS = \
 	appdefaults.c \
Index: programs/winecfg/audio.c
===================================================================
RCS file: /home/wine/wine/programs/winecfg/audio.c,v
retrieving revision 1.10
diff -p -u -r1.10 audio.c
--- programs/winecfg/audio.c	27 Jun 2005 09:48:06 -0000	1.10
+++ programs/winecfg/audio.c	28 Jun 2005 11:30:13 -0000
@@ -37,6 +37,7 @@
 #include <shlguid.h>
 #include <shlwapi.h>
 #include <shlobj.h>
+#include <mmsystem.h>
 
 #include "winecfg.h"
 #include "resource.h"
@@ -64,6 +65,49 @@ static void selectAudioDriver(HWND hDlg,
   }
 }
 
+static void configureAudioDriver(HWND hDlg, const char *drivername)
+{
+  int i;
+  const AUDIO_DRIVER *pAudioDrv = NULL;
+
+  if ((pAudioDrv = getAudioDrivers()))
+  {
+    for (i = 0; *pAudioDrv->szName; i++, pAudioDrv++)
+    {
+      if (!strcmp (pAudioDrv->szDriver, drivername))
+      {
+        if (strlen(pAudioDrv->szDriver) != 0)
+        {
+          HDRVR hdrvr;
+	  char wine_driver[MAX_NAME_LENGTH + 8];
+	  sprintf(wine_driver, "wine%s.drv", pAudioDrv->szDriver);
+          hdrvr = OpenDriverA(wine_driver, 0, 0);
+	  if (hdrvr != 0)
+	  {
+	    if (SendDriverMessage(hdrvr, DRV_QUERYCONFIGURE, 0, 0) != 0)
+	    {
+              DRVCONFIGINFO dci;
+              LONG lRes;
+              dci.dwDCISize = sizeof (dci);
+              dci.lpszDCISectionName = (LPWSTR)0;
+              dci.lpszDCIAliasName = (LPWSTR)0;
+              lRes = SendDriverMessage(hdrvr, DRV_CONFIGURE, 0, (LONG)&dci);
+	    }
+	    CloseDriver(hdrvr, 0, 0);
+	  }
+          else
+          {
+	    char str[1024];
+	    sprintf(str, "Couldn't open %s!", wine_driver);
+	    MessageBox(NULL, str, "Fixme", MB_OK | MB_ICONERROR);
+          }
+	}
+	break;
+      }
+    }
+  }
+}
+
 static void initAudioDlg (HWND hDlg)
 {
     char *curAudioDriver = get_reg_key(config_key, "Drivers", "Audio", "alsa");
@@ -172,6 +216,16 @@ AudioDlgProc (HWND hDlg, UINT uMsg, WPAR
 		selectAudioDriver(hDlg, (char*)pAudioDrv[selected_driver].szDriver);
 	     }
 	     break;
+          case IDC_AUDIO_CONFIGURE:
+	     {
+		const AUDIO_DRIVER *pAudioDrv = getAudioDrivers();
+		int selected_driver = SendDlgItemMessage(hDlg, IDC_AUDIO_DRIVER, CB_GETCURSEL, 0, 0);
+		configureAudioDriver(hDlg, (char*)pAudioDrv[selected_driver].szDriver);
+	     }
+	     break;
+          case IDC_AUDIO_CONTROL_PANEL:
+	     MessageBox(NULL, "Launching audio control panel not implemented yet!", "Fixme", MB_OK | MB_ICONERROR);
+             break;
 	}
 	break;
 
Index: programs/winecfg/resource.h
===================================================================
RCS file: /home/wine/wine/programs/winecfg/resource.h,v
retrieving revision 1.24
diff -p -u -r1.24 resource.h
--- programs/winecfg/resource.h	19 May 2005 11:14:52 -0000	1.24
+++ programs/winecfg/resource.h	28 Jun 2005 11:30:13 -0000
@@ -123,3 +123,6 @@
 /* audio tab */
 #define IDC_AUDIO_AUTODETECT            1300
 #define IDC_AUDIO_DRIVER                1301
+#define IDC_AUDIO_CONFIGURE             1302
+#define IDC_AUDIO_CONTROL_PANEL         1303
+


More information about the wine-patches mailing list