Time Stamping MIDI Input

MIDI input drivers must time-stamp incoming MIDI events. The time stamp is the number of milliseconds since MIDI input was started.

The MIDM_START message resets time stamps to zero. When your midMessage entry-point function receives a MIDM_START message, use timeGetTime to get a reference time stamp. Then, each time you receive an incoming MIDI event, call timeGetTime to get the current system time. Subtract the reference time stamp from the current system time to get a time stamp for the MIDI event. For multi-byte MIDI events, the time stamp specifies when the first byte (the MIDI status byte) was received.

Note

If the target hardware supports time stamping, you can use its capabilities to generate time stamps more efficiently than calling the timeGetTime function. However, time stamps must still specify the time in milliseconds since MIDI input was started with the MIDM_START message.