diff options
-rw-r--r-- | core/qmpmidiplay.cpp | 9 | ||||
-rw-r--r-- | core/qmpmidiplay.hpp | 2 |
2 files changed, 8 insertions, 3 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)); diff --git a/core/qmpmidiplay.hpp b/core/qmpmidiplay.hpp index a4245ae..ddbb63b 100644 --- a/core/qmpmidiplay.hpp +++ b/core/qmpmidiplay.hpp @@ -65,7 +65,7 @@ private: int32_t rpnid[16], rpnval[16]; uint16_t mute, solo; double ftime; - bool sendSysEx, waitvoice; + bool sendSysEx; uint8_t chstatus[16][130];//0..127: cc 128: pc uint32_t ctempo, ctsn, ctsd, divs, cks; double dpt;//time per tick |