diff options
author | Chris Xiong <chirs241097@gmail.com> | 2016-01-26 11:52:28 +0800 |
---|---|---|
committer | Chris Xiong <chirs241097@gmail.com> | 2016-01-26 11:52:28 +0800 |
commit | 1785e14480ab00afc4309bfcfbd5b00caea8ddde (patch) | |
tree | 2dc5f70fe455afedf6393a0db2d7f09ceae1f715 /qmpmidiplay.cpp | |
parent | ebda8030fdb70a8162c67947dd980b59337f2d05 (diff) | |
download | QMidiPlayer-1785e14480ab00afc4309bfcfbd5b00caea8ddde.tar.xz |
Dark Road. (WTF)
Diffstat (limited to 'qmpmidiplay.cpp')
-rw-r--r-- | qmpmidiplay.cpp | 7 |
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; } |