MidiMessageCollector not correctly computing sampleNumber


Hi Jules,

The win32 midiIn callback timestamps the events with Time::getMillisecondCounter() , but MidiMessageCollector uses Time::getMillisecondCounterHiRes()

The problem is that those two counters are quite different here, their values differ by approximately 0.3 second ! As a consequence the sampleNumber of incoming midi messages is not correctly evaluated.

Should the win32 midi code use the HiRes counter or should the MidiMessageCollector use the normal counter ? It seems that the coremidi version uses getMillisecondCounterHiRes , and the linux ALSA version uses getMillisecondCounter


Wow, 0.3 second! Ok… I guess that everything should be using the hi-res version then. Easy enough to change, I’ll do that…


Just wanted to mention two warnings after a change:

1>c:\devel\juce\modules\juce_audio_devices\native/juce_win32_Midi.cpp(202): warning C4244: '+=' : conversion from 'double' to 'juce::uint32', possible loss of data
1>c:\devel\juce\modules\juce_audio_devices\native/juce_win32_Midi.cpp(210): warning C4244: '=' : conversion from 'const double' to 'juce::uint32', possible loss of data


Thanks, I’ll tidy that up!