diff options
author | Chris Xiong <chirs241097@gmail.com> | 2021-01-07 14:06:30 +0800 |
---|---|---|
committer | Chris Xiong <chirs241097@gmail.com> | 2021-01-07 14:06:30 +0800 |
commit | 327526848c930c5cca7fafbde36d60ea45b786db (patch) | |
tree | 719a0525658557c6924a975bd966fdd6559c78a8 /core/qmpmidiplay.cpp | |
parent | 51d627aa7a879d1840142fb53bc3dfbbf1696411 (diff) | |
download | QMidiPlayer-327526848c930c5cca7fafbde36d60ea45b786db.tar.xz |
Fix another freezing issue on Windows.
insert bad pun here
Diffstat (limited to 'core/qmpmidiplay.cpp')
-rw-r--r-- | core/qmpmidiplay.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/core/qmpmidiplay.cpp b/core/qmpmidiplay.cpp index 6a24024..e8e83a2 100644 --- a/core/qmpmidiplay.cpp +++ b/core/qmpmidiplay.cpp @@ -242,6 +242,12 @@ void CMidiPlayer::playEvents() double correction = (getTick() - ttick) * dpt - (b - ttime).count(); if (correction > 0) correction = 0; + else if (ns_sleep + correction < 0) + { + ttick = getTick(); + ttime = high_resolution_clock::now(); + ns_sleep = correction = 0; + } if (ns_sleep + correction > 2.5e8) { high_resolution_clock::time_point t = high_resolution_clock::now(); @@ -266,7 +272,7 @@ void CMidiPlayer::playEvents() } else if (tts < 0) { - fputs("ur operating system (or toolchain) suck!!\n", stderr); + // this shouldn't happen... but ok } } else @@ -354,7 +360,6 @@ CMidiPlayer::CMidiPlayer() midiReaders = new CMidiFileReaderCollection(); resumed = false; midiFile = nullptr; - waitvoice = true; event_handlers_id = event_read_handlers_id = file_read_finish_hooks_id = 0; memset(eventHandlerCB, 0, sizeof(eventHandlerCB)); memset(eventHandlerCBuserdata, 0, sizeof(eventHandlerCBuserdata)); |