win32: disable sound sync when speed is not set to 100%

This commit is contained in:
OV2 2018-01-03 22:50:09 +01:00
parent e2f764fc0c
commit aad3f375db

View File

@ -264,6 +264,7 @@ extern SNPServer NPServer;
__int64 PCBase, PCFrameTime, PCFrameTimeNTSC, PCFrameTimePAL, PCStart, PCEnd;
DWORD PCStartTicks, PCEndTicks;
bool PCFrameTimeIsDefault = true;
INT_PTR CALLBACK DlgSoundConf(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK DlgInfoProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
@ -274,7 +275,6 @@ INT_PTR CALLBACK DlgOpenROMProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lPara
INT_PTR CALLBACK DlgMultiROMProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK DlgChildSplitProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK DlgNPProgress(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK DlgPackConfigProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK DlgNetConnect(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK DlgNPOptions(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK DlgFunky(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
@ -3579,7 +3579,8 @@ int WINAPI WinMain(
{
ProcessInput();
while(!S9xSyncSound()) {
// no sound sync when speed is not set to 100%
while(PCFrameTimeIsDefault && !S9xSyncSound()) {
ResetEvent(GUI.SoundSyncEvent);
if(WaitForSingleObject(GUI.SoundSyncEvent,1000) != WAIT_OBJECT_0)
S9xClearSamples();
@ -4041,6 +4042,8 @@ static void ResetFrameTimer ()
else if (Settings.FrameTime == Settings.FrameTimePAL) PCFrameTime = PCFrameTimePAL;
else PCFrameTime = (__int64)((double)(PCBase * Settings.FrameTime) * .000001);
// determines if we can do sound sync
PCFrameTimeIsDefault = Settings.PAL ? Settings.FrameTime == Settings.FrameTimePAL : Settings.FrameTime == Settings.FrameTimeNTSC;
if (GUI.hFrameTimer)
timeKillEvent (GUI.hFrameTimer);