diff options
author | Chris Xiong <chirs241097@gmail.com> | 2016-03-19 11:53:26 +0800 |
---|---|---|
committer | Chris Xiong <chirs241097@gmail.com> | 2016-03-19 11:53:26 +0800 |
commit | 6015dccd4a839d46749a3bf7c0e45263ac8870ca (patch) | |
tree | c15b1c06bb7464fe0c993fbda97f472d8fd7436e | |
parent | 3270ec6072b333c548587621b141ee283beecc29 (diff) | |
download | QMidiPlayer-6015dccd4a839d46749a3bf7c0e45263ac8870ca.tar.xz |
Fairy Wars.
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | qmpmidiplay.cpp | 13 |
2 files changed, 12 insertions, 5 deletions
@@ -1,3 +1,7 @@ +2016-03-19 0.7.0 beta +Minor changes on w32usleep... +Sync with the Windows build. + 2016-02-28 0.7.0 beta RPN pitch bend range handling. Added an option to disable waiting for remaining voices before stopping. diff --git a/qmpmidiplay.cpp b/qmpmidiplay.cpp index ebbf36e..8da2963 100644 --- a/qmpmidiplay.cpp +++ b/qmpmidiplay.cpp @@ -5,6 +5,7 @@ #include "qmpmidiplay.hpp" #ifdef _WIN32 #include <windows.h> +uint64_t pf; #endif void CMidiPlayer::fluidPreInitialize() { @@ -144,15 +145,14 @@ void CMidiPlayer::processEventStub(const SEvent *e) #ifdef _WIN32 void w32usleep(uint64_t t) { - uint64_t st=0,ct=0,f=0; - QueryPerformanceFrequency((LARGE_INTEGER*)&f); + uint64_t st=0,ct=0; QueryPerformanceCounter((LARGE_INTEGER*)&st); do{ - if(t>10000+(ct-st)*1000000/f)Sleep((t-(ct-st)*1000000/f)/2000); - else if(t>5000+(ct-st)*1000000/f)Sleep(1); + if(t>10000+(ct-st)*1000000/pf)Sleep((t-(ct-st)*1000000/pf)/2000); + else if(t>5000+(ct-st)*1000000/pf)Sleep(1); else std::this_thread::yield(); QueryPerformanceCounter((LARGE_INTEGER*)&ct); - }while((ct-st)*1000000<t*f); + }while((ct-st)*1000000<t*pf); } #endif void CMidiPlayer::playEvents() @@ -229,6 +229,9 @@ CMidiPlayer::CMidiPlayer(bool singleInst) { midiFile=NULL;resumed=false;singleInstance=singleInst; settings=NULL;synth=NULL;adriver=NULL;waitvoice=true; +#ifdef _WIN32 + QueryPerformanceFrequency((LARGE_INTEGER*)&pf); +#endif } CMidiPlayer::~CMidiPlayer(){if(singleInstance)fluidDeinitialize();} void CMidiPlayer::playerPanic(bool reset) |