aboutsummaryrefslogtreecommitdiff
path: root/qmpmidiplay.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qmpmidiplay.cpp')
-rw-r--r--qmpmidiplay.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/qmpmidiplay.cpp b/qmpmidiplay.cpp
index d099384..2dbc753 100644
--- a/qmpmidiplay.cpp
+++ b/qmpmidiplay.cpp
@@ -2,6 +2,9 @@
#include <chrono>
#include <thread>
#include <fluidsynth.h>
+#ifdef _WIN32
+#include <QThread>
+#endif
#include "qmpmidiplay.hpp"
void CMidiPlayer::fluidInitialize()
{
@@ -125,7 +128,11 @@ void CMidiPlayer::playEvents()
if(tcstop||!midiFile||tceptr>=midiFile->getEventCount())break;
if(resumed)resumed=false;
else
+#ifdef _WIN32
+ QThread::usleep((midiFile->getEvent(tceptr)->time-ct)*(dpt/1000));
+#else
std::this_thread::sleep_for(std::chrono::nanoseconds(midiFile->getEvent(tceptr)->time-ct)*dpt);
+#endif
if(tcstop||!midiFile)break;
ct=midiFile->getEvent(tceptr)->time;
}