[winecfg] add default dsound sample rate and bits per sample
Robert Reif
reif at earthlink.net
Wed Apr 5 19:53:02 CDT 2006
This patch adds the ability to set and change the default Direct Sound
primary buffer sample rate and bits per sample for win2k and xp
programs that don't bother to change the win9x default 22050x8
to something reasonable for the program.
-------------- next part --------------
Index: programs/winecfg/En.rc
===================================================================
RCS file: /home/wine/wine/programs/winecfg/En.rc,v
retrieving revision 1.62
diff -p -u -r1.62 En.rc
--- programs/winecfg/En.rc 16 Feb 2006 20:08:35 -0000 1.62
+++ programs/winecfg/En.rc 6 Apr 2006 00:38:12 -0000
@@ -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
Index: programs/winecfg/audio.c
===================================================================
RCS file: /home/wine/wine/programs/winecfg/audio.c,v
retrieving revision 1.26
diff -p -u -r1.26 audio.c
--- programs/winecfg/audio.c 18 Mar 2006 18:52:32 -0000 1.26
+++ programs/winecfg/audio.c 6 Apr 2006 00:38:13 -0000
@@ -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);
Index: programs/winecfg/resource.h
===================================================================
RCS file: /home/wine/wine/programs/winecfg/resource.h,v
retrieving revision 1.40
diff -p -u -r1.40 resource.h
--- programs/winecfg/resource.h 16 Feb 2006 20:08:36 -0000 1.40
+++ programs/winecfg/resource.h 6 Apr 2006 00:38:13 -0000
@@ -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-patches
mailing list