winmm: Reset the tick counter after handling messages.

Otherwise, events might be triggered immediately after a resuming.

Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Akihiro Sagawa 2018-05-29 08:19:08 -05:00 committed by Alexandre Julliard
parent 2e2ff80567
commit 3840443958
2 changed files with 4 additions and 2 deletions

View File

@ -893,7 +893,7 @@ static void test_midiStream(UINT udev, HWND hwnd)
expected = 250; /* = 12 ticks in 120 BPM */
ret = get_position(hm, TIME_MS);
todo_wine ok(ret >= expected - MARGIN && ret <= expected + MARGIN,
ok(ret >= expected - MARGIN && ret <= expected + MARGIN,
"expected greater than %ums, got %ums\n", expected, ret);
trace("after playing, got %ums\n", ret);
@ -914,7 +914,7 @@ static void test_midiStream(UINT udev, HWND hwnd)
So, the second event happens at dwDeltaTime(250ms) + 100ms after the first event. */
expected = 250 + 100;
diff = records.time_stamp[1] - records.time_stamp[0];
todo_wine ok(diff >= expected - MARGIN && diff <= expected + MARGIN,
ok(diff >= expected - MARGIN && diff <= expected + MARGIN,
"expected %u ~ %ums, got %ums (dev=%d)\n", expected - MARGIN, expected + MARGIN, diff, udev);
rc = midiOutUnprepareHeader((HMIDIOUT)hm, &mhdr, sizeof(mhdr));

View File

@ -1197,6 +1197,8 @@ start_header:
goto start_header;
}
}
/* reset dwToGo because dwStartTicks might be updated */
dwToGo = lpMidiStrm->dwStartTicks + lpMidiStrm->dwPositionMS;
} else {
/* timeout, so me->dwDeltaTime is elapsed, can break the while loop */
break;