Make GUI more user-friendly by disabling some options when they aren't used.

This commit is contained in:
Christian Kenny 2017-06-12 20:47:15 -04:00 committed by Jonathan Li
parent af74a75c54
commit 168402217f
2 changed files with 26 additions and 1 deletions

View File

@ -205,6 +205,22 @@ void WriteSettings()
DebugConfig::WriteSettings();
}
void CheckOutputModule(HWND window)
{
OutputModule = SendMessage(GetDlgItem(window, IDC_OUTPUT), CB_GETCURSEL, 0, 0);
const bool IsConfigurable =
mods[OutputModule] == PortaudioOut ||
mods[OutputModule] == WaveOut ||
mods[OutputModule] == DSoundOut;
const bool AudioExpansion =
mods[OutputModule] == XAudio2Out ||
mods[OutputModule] == PortaudioOut;
EnableWindow(GetDlgItem(window, IDC_OUTCONF), IsConfigurable);
EnableWindow(GetDlgItem(window, IDC_SPEAKERS), AudioExpansion);
}
BOOL CALLBACK ConfigProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
int wmId, wmEvent;
@ -262,6 +278,8 @@ BOOL CALLBACK ConfigProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
swprintf_s(temp, L"%d%%", configvol);
SetWindowText(GetDlgItem(hWnd, IDC_VOLUME_LABEL), temp);
CheckOutputModule(hWnd);
EnableWindow(GetDlgItem(hWnd, IDC_OPEN_CONFIG_SOUNDTOUCH), (SynchMode == 0));
EnableWindow(GetDlgItem(hWnd, IDC_OPEN_CONFIG_DEBUG), DebugEnabled);
@ -294,6 +312,12 @@ BOOL CALLBACK ConfigProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
EndDialog(hWnd, 0);
break;
case IDC_OUTPUT:
if (wmEvent == CBN_SELCHANGE) {
CheckOutputModule(hWnd);
}
break;
case IDC_OUTCONF: {
const int module = (int)SendMessage(GetDlgItem(hWnd, IDC_OUTPUT), CB_GETCURSEL, 0, 0);
if (mods[module] == NULL)

View File

@ -62,7 +62,7 @@ BEGIN
LTEXT "Module:",IDC_STATIC,161,16,50,9,NOT WS_GROUP
LTEXT "(speedup!) Skips reverb effects processing, but won't sound as good in most games.",IDC_STATIC,26,60,104,36
LTEXT "(currently requires manual configuration via the ini file)",IDC_STATIC,162,236,146,20
CTEXT "100 ms (avg)",IDC_LATENCY_LABEL,224,86,58,9
CTEXT "100 ms (avg)",IDC_LATENCY_LABEL,224,84,58,9
CONTROL 116,IDC_STATIC,"Static",SS_BITMAP | SS_REALSIZECONTROL,6,213,119,55,WS_EX_CLIENTEDGE
PUSHBUTTON "Advanced...",IDC_OPEN_CONFIG_SOUNDTOUCH,219,149,84,12
PUSHBUTTON "Configure Debug Options...",IDC_OPEN_CONFIG_DEBUG,14,167,108,14
@ -122,6 +122,7 @@ BEGIN
CTEXT "8 (80 ms latency)",IDC_LATENCY_LABEL,70,37,95,11
END
// fixme: This dialog doesn't work (was it ever used in the first place?)
IDD_XAUDIO2 DIALOGEX 0, 0, 202, 116
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "XAudio2 Output Module Settings"