Robert Reif : winecfg: Add default dsound sample rate and bits per sample.

Alexandre Julliard julliard at wine.codeweavers.com
Sat Apr 8 13:12:22 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: a76023f02a7b1e01824b54c9fb902fdb5e1e53dc
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=a76023f02a7b1e01824b54c9fb902fdb5e1e53dc

Author: Robert Reif <reif at earthlink.net>
Date:   Wed Apr  5 20:53:02 2006 -0400

winecfg: Add default dsound sample rate and bits per sample.

---

 programs/winecfg/En.rc      |    6 ++++-
 programs/winecfg/audio.c    |   56 +++++++++++++++++++++++++++++++++++++++++++
 programs/winecfg/resource.h |    2 ++
 3 files changed, 63 insertions(+), 1 deletions(-)

diff --git a/programs/winecfg/En.rc b/programs/winecfg/En.rc
index 243913b..f759aaf 100644
--- a/programs/winecfg/En.rc
+++ b/programs/winecfg/En.rc
@@ -168,7 +168,11 @@ BEGIN
     GROUPBOX        " DirectSound ",IDC_STATIC,8,205,244,60
     LTEXT	    "Hardware Acceleration: ",IDC_STATIC,15,215,90,10
     COMBOBOX	    IDC_DSOUND_HW_ACCEL,100,213,150,70,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
-    CONTROL         "Driver Emulation",IDC_DSOUND_DRV_EMUL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,230,230,10
+    LTEXT           "Default Sample Rate:",IDC_STATIC,15,232,70,8
+    COMBOBOX        IDC_DSOUND_RATES,90,230,42,76,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    LTEXT           "Default Bits Per Sample:",IDC_STATIC,137,232,80,8
+    COMBOBOX        IDC_DSOUND_BITS,220,230,30,56,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+    CONTROL         "Driver Emulation",IDC_DSOUND_DRV_EMUL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,250,230,10
 END
 
 IDD_DESKTOP_INTEGRATION DIALOG DISCARDABLE  0, 0, 260, 250
diff --git a/programs/winecfg/audio.c b/programs/winecfg/audio.c
index ba82e54..3ad7f24 100644
--- a/programs/winecfg/audio.c
+++ b/programs/winecfg/audio.c
@@ -60,6 +60,22 @@ static const char* DSound_HW_Accels[] = 
   NULL
 };
 
+static const char* DSound_Rates[] = {
+  "48000",
+  "44100",
+  "22050",
+  "16000",
+  "11025",
+  "8000",
+  NULL
+};
+
+static const char* DSound_Bits[] = {
+  "8",
+  "16",
+  NULL
+};
+
 static const AUDIO_DRIVER sAudioDrivers[] = {
   {"ALSA", "alsa"},
   {"aRts", "arts"},
@@ -635,6 +651,30 @@ static void initAudioDlg (HWND hDlg)
     }
     HeapFree(GetProcessHeap(), 0, buf);
 
+    SendDlgItemMessage(hDlg, IDC_DSOUND_RATES, CB_RESETCONTENT, 0, 0);
+    for (i = 0; NULL != DSound_Rates[i]; ++i) {
+      SendDlgItemMessage(hDlg, IDC_DSOUND_RATES, CB_ADDSTRING, 0, (LPARAM) DSound_Rates[i]);
+    }
+    buf = get_reg_key(config_key, keypath("DirectSound"), "DefaultSampleRate", "22050");
+    for (i = 0; NULL != DSound_Rates[i]; ++i) {
+      if (strcmp(buf, DSound_Rates[i]) == 0) {
+	SendDlgItemMessage(hDlg, IDC_DSOUND_RATES, CB_SETCURSEL, i, 0);
+	break ;
+      }
+    }
+
+    SendDlgItemMessage(hDlg, IDC_DSOUND_BITS, CB_RESETCONTENT, 0, 0);
+    for (i = 0; NULL != DSound_Bits[i]; ++i) {
+      SendDlgItemMessage(hDlg, IDC_DSOUND_BITS, CB_ADDSTRING, 0, (LPARAM) DSound_Bits[i]);
+    }
+    buf = get_reg_key(config_key, keypath("DirectSound"), "DefaultBitsPerSample", "8");
+    for (i = 0; NULL != DSound_Bits[i]; ++i) {
+      if (strcmp(buf, DSound_Bits[i]) == 0) {
+	SendDlgItemMessage(hDlg, IDC_DSOUND_BITS, CB_SETCURSEL, i, 0);
+	break ;
+      }
+    }
+
     buf = get_reg_key(config_key, keypath("DirectSound"), "EmulDriver", "N");
     if (IS_OPTION_TRUE(*buf))
       CheckDlgButton(hDlg, IDC_DSOUND_DRV_EMUL, BST_CHECKED);
@@ -663,6 +703,22 @@ AudioDlgProc (HWND hDlg, UINT uMsg, WPAR
 	      set_reg_key(config_key, keypath("DirectSound"), "HardwareAcceleration", DSound_HW_Accels[selected_dsound_accel]);
 	    }
 	    break;
+          case IDC_DSOUND_RATES:
+	    if (HIWORD(wParam) == CBN_SELCHANGE) {
+	      int selected_dsound_rate;
+	      SendMessage(GetParent(hDlg), PSM_CHANGED, 0, 0);
+	      selected_dsound_rate = SendDlgItemMessage(hDlg, IDC_DSOUND_RATES, CB_GETCURSEL, 0, 0);
+	      set_reg_key(config_key, keypath("DirectSound"), "DefaultSampleRate", DSound_Rates[selected_dsound_rate]);
+	    }
+	    break;
+          case IDC_DSOUND_BITS:
+	    if (HIWORD(wParam) == CBN_SELCHANGE) {
+	      int selected_dsound_bits;
+	      SendMessage(GetParent(hDlg), PSM_CHANGED, 0, 0);
+	      selected_dsound_bits = SendDlgItemMessage(hDlg, IDC_DSOUND_BITS, CB_GETCURSEL, 0, 0);
+	      set_reg_key(config_key, keypath("DirectSound"), "DefaultBitsPerSample", DSound_Bits[selected_dsound_bits]);
+	    }
+	    break;
           case IDC_DSOUND_DRV_EMUL:
 	    if (HIWORD(wParam) == BN_CLICKED) {
 	      SendMessage(GetParent(hDlg), PSM_CHANGED, 0, 0);
diff --git a/programs/winecfg/resource.h b/programs/winecfg/resource.h
index 52b239e..c2cc77f 100644
--- a/programs/winecfg/resource.h
+++ b/programs/winecfg/resource.h
@@ -151,6 +151,8 @@
 #define IDB_CHECKBOX                    1306
 #define IDB_DEVICE                      1307
 #define IDS_AUDIO_MISSING               1308
+#define IDC_DSOUND_RATES                1309
+#define IDC_DSOUND_BITS                 1310
 
 /* desktop integration tab */
 #define IDC_THEME_COLORCOMBO            1401




More information about the wine-cvs mailing list