Akihiro Sagawa : winmm: Reset the tick counter after handling messages.

Alexandre Julliard julliard at winehq.org
Tue May 29 16:08:31 CDT 2018


Module: wine
Branch: master
Commit: 3840443958aaae161a22c071f79eb54b969b0af0
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=3840443958aaae161a22c071f79eb54b969b0af0

Author: Akihiro Sagawa <sagawa.aki at gmail.com>
Date:   Tue May 29 08:19:08 2018 -0500

winmm: Reset the tick counter after handling messages.

Otherwise, events might be triggered immediately after a resuming.

Signed-off-by: Akihiro Sagawa <sagawa.aki at gmail.com>
Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/winmm/tests/midi.c | 4 ++--
 dlls/winmm/winmm.c      | 2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/dlls/winmm/tests/midi.c b/dlls/winmm/tests/midi.c
index 091a500..fe3cc5c 100644
--- a/dlls/winmm/tests/midi.c
+++ b/dlls/winmm/tests/midi.c
@@ -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));
diff --git a/dlls/winmm/winmm.c b/dlls/winmm/winmm.c
index 2031c79..ef7dcdf 100644
--- a/dlls/winmm/winmm.c
+++ b/dlls/winmm/winmm.c
@@ -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;




More information about the wine-cvs mailing list