win32: only enable dynamic rate control checkbox for xaudio2

This commit is contained in:
OV2 2018-01-03 21:06:56 +01:00
parent 4c69595ffe
commit 67d04aeb77
1 changed files with 4 additions and 1 deletions

View File

@ -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);