1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-02-02 03:20:06 +00:00

Used hi-res timer in win32 midi input.

This commit is contained in:
jules 2012-06-21 09:30:50 +01:00
parent 9821174709
commit cc8b0aad47

View file

@ -83,7 +83,7 @@ public:
for (int i = 0; i < (int) numHeaders; ++i)
headers[i].write (deviceHandle);
startTime = Time::getMillisecondCounter();
startTime = Time::getMillisecondCounterHiRes();
MMRESULT res = midiInStart (deviceHandle);
if (res == MMSYSERR_NOERROR)
@ -134,7 +134,7 @@ private:
MidiInputCallback& callback;
MidiDataConcatenator concatenator;
bool volatile isStarted;
uint32 startTime;
double startTime;
class MidiHeader
{
@ -201,11 +201,11 @@ private:
{
timeStamp += startTime;
const uint32 now = Time::getMillisecondCounter();
const double now = Time::getMillisecondCounterHiRes();
if (timeStamp > now)
{
if (timeStamp > now + 2)
--startTime;
if (timeStamp > now + 2.0)
startTime -= 1.0;
timeStamp = now;
}