From 67d04aeb77193c8d8b8192fd1b1bae4f795d8221 Mon Sep 17 00:00:00 2001 From: OV2 Date: Wed, 3 Jan 2018 21:06:56 +0100 Subject: [PATCH] win32: only enable dynamic rate control checkbox for xaudio2 --- win32/wsnes9x.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/win32/wsnes9x.cpp b/win32/wsnes9x.cpp index 596884f3..d346265f 100644 --- a/win32/wsnes9x.cpp +++ b/win32/wsnes9x.cpp @@ -265,7 +265,6 @@ extern SNPServer NPServer; __int64 PCBase, PCFrameTime, PCFrameTimeNTSC, PCFrameTimePAL, PCStart, PCEnd; DWORD PCStartTicks, PCEndTicks; -INT_PTR CALLBACK DlgSP7PackConfig(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam); INT_PTR CALLBACK DlgSoundConf(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam); INT_PTR CALLBACK DlgInfoProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam); INT_PTR CALLBACK DlgAboutProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam); @@ -4471,6 +4470,7 @@ INT_PTR CALLBACK DlgSoundConf(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) CreateToolTip(IDC_INRATEEDIT,hDlg,TEXT("For each 'Input rate' samples generated by the SNES, 'Playback rate' samples will produced. If you experience crackling you can try to lower this setting.")); CreateToolTip(IDC_INRATE,hDlg,TEXT("For each 'Input rate' samples generated by the SNES, 'Playback rate' samples will produced. If you experience crackling you can try to lower this setting.")); + CreateToolTip(IDC_DYNRATECONTROL, hDlg, TEXT("Try to dynamically adjust the input rate to never overflow or underflow the sound buffer. Only works with XAudio2.")); int pos; pos = SendDlgItemMessage(hDlg, IDC_DRIVER, CB_INSERTSTRING,-1,(LPARAM)TEXT("Snes9x DirectSound")); @@ -4499,6 +4499,7 @@ INT_PTR CALLBACK DlgSoundConf(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) break; } } + EnableWindow(GetDlgItem(hDlg, IDC_DYNRATECONTROL), GUI.SoundDriver == WIN_XAUDIO2_SOUND_DRIVER); SendDlgItemMessage(hDlg, IDC_INRATE, TBM_SETRANGE,TRUE,MAKELONG(0,20)); SendDlgItemMessage(hDlg, IDC_INRATE, TBM_SETPOS,TRUE,(Settings.SoundInputRate - 31100)/50); @@ -4678,12 +4679,14 @@ INT_PTR CALLBACK DlgSoundConf(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) { int driver=SendDlgItemMessage(hDlg, IDC_DRIVER, CB_GETITEMDATA, SendDlgItemMessage(hDlg, IDC_DRIVER, CB_GETCURSEL, 0,0),0); + EnableWindow(GetDlgItem(hDlg, IDC_DYNRATECONTROL), FALSE); switch(driver) { case WIN_SNES9X_DIRECT_SOUND_DRIVER: SendDlgItemMessage(hDlg,IDC_BUFLEN,CB_SETCURSEL,3,0); break; case WIN_XAUDIO2_SOUND_DRIVER: SendDlgItemMessage(hDlg,IDC_BUFLEN,CB_SETCURSEL,3,0); + EnableWindow(GetDlgItem(hDlg, IDC_DYNRATECONTROL), TRUE); break; default: SendDlgItemMessage(hDlg,IDC_BUFLEN,CB_SETCURSEL,7,0);