SPU2-X: Experimental change! Lowered the lower latency limit to 3ms if the timestretcher is not being used. This latency will add up to the output latency as usual, but with a good sound chip this should allow overall latencies < 15ms.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4854 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
gigaherz 2011-08-08 15:56:49 +00:00
parent f2bc219425
commit 224797c4ec
1 changed files with 29 additions and 2 deletions

View File

@ -24,7 +24,8 @@ static const int LATENCY_MAX = 3000;
static const int LATENCY_MAX = 750; static const int LATENCY_MAX = 750;
#endif #endif
static const int LATENCY_MIN = 50; static const int LATENCY_MIN = 3;
static const int LATENCY_MIN_TS = 50;
// MIXING // MIXING
int Interpolation = 4; int Interpolation = 4;
@ -71,6 +72,11 @@ void ReadSettings()
numSpeakers = CfgReadInt( L"OUTPUT", L"XAudio2_SpeakerConfiguration", 0); numSpeakers = CfgReadInt( L"OUTPUT", L"XAudio2_SpeakerConfiguration", 0);
SndOutLatencyMS = CfgReadInt(L"OUTPUT",L"Latency", 150); SndOutLatencyMS = CfgReadInt(L"OUTPUT",L"Latency", 150);
if((SynchMode == 0) && (SndOutLatencyMS < LATENCY_MIN_TS)) // can't use low-latency with timestretcher atm
SndOutLatencyMS = LATENCY_MIN_TS;
else if(SndOutLatencyMS < LATENCY_MIN)
SndOutLatencyMS = LATENCY_MIN;
wchar_t omodid[128]; wchar_t omodid[128];
CfgReadStr( L"OUTPUT", L"Output_Module", omodid, 127, XAudio2Out->GetIdent() ); CfgReadStr( L"OUTPUT", L"Output_Module", omodid, 127, XAudio2Out->GetIdent() );
@ -179,7 +185,8 @@ BOOL CALLBACK ConfigProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
} }
SendDialogMsg( hWnd, IDC_OUTPUT, CB_SETCURSEL, OutputModule, 0 ); SendDialogMsg( hWnd, IDC_OUTPUT, CB_SETCURSEL, OutputModule, 0 );
int minexp = (int)(pow( (double)LATENCY_MIN+1, 1.0/3.0 ) * 128.0); double minlat = (SynchMode == 0)?LATENCY_MIN_TS:LATENCY_MIN;
int minexp = (int)(pow( minlat+1, 1.0/3.0 ) * 128.0);
int maxexp = (int)(pow( (double)LATENCY_MAX+2, 1.0/3.0 ) * 128.0); int maxexp = (int)(pow( (double)LATENCY_MAX+2, 1.0/3.0 ) * 128.0);
INIT_SLIDER( IDC_LATENCY_SLIDER, minexp, maxexp, 200, 42, 1 ); INIT_SLIDER( IDC_LATENCY_SLIDER, minexp, maxexp, 200, 42, 1 );
@ -249,6 +256,26 @@ BOOL CALLBACK ConfigProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
} }
break; break;
case IDC_SYNCHMODE:
{
if(wmEvent == CBN_SELCHANGE)
{
int sMode = (int)SendDialogMsg( hWnd, IDC_SYNCHMODE, CB_GETCURSEL,0,0 );
double minlat = (sMode == 0)?LATENCY_MIN_TS:LATENCY_MIN;
int minexp = (int)(pow( minlat+1, 1.0/3.0 ) * 128.0);
int maxexp = (int)(pow( (double)LATENCY_MAX+2, 1.0/3.0 ) * 128.0);
INIT_SLIDER( IDC_LATENCY_SLIDER, minexp, maxexp, 200, 42, 1 );
int curpos = (int)SendMessage(GetDlgItem( hWnd, IDC_LATENCY_SLIDER ),TBM_GETPOS,0,0);
double res = pow( curpos / 128.0, 3.0 );
curpos = (int)res;
swprintf_s(temp,L"%d ms (avg)",curpos);
SetDlgItemText(hWnd,IDC_LATENCY_LABEL,temp);
}
}
break;
case IDC_OPEN_CONFIG_SOUNDTOUCH: case IDC_OPEN_CONFIG_SOUNDTOUCH:
SoundtouchCfg::OpenDialog( hWnd ); SoundtouchCfg::OpenDialog( hWnd );
break; break;