atsushieno / managed-midi

[Past project] Cross-platform MIDI processing library for mono and .NET (ALSA, CoreMIDI, Android, WinMM and UWP).
MIT License
195 stars 26 forks source link

MidiReceivedEventArgs timestamping in inputs #27

Open atsushieno opened 5 years ago

atsushieno commented 5 years ago

MidiReceivedEventArgs has Timestamp property, and IMidiInput is supposed to provide timestamps, if sent by the input devices, or the device should give it. However, there is no common ground on how those timestamps are given.

It is most likely a timestamp value is an absolute value within a process, but it is relative to something like app start time (e.g. Web MIDI API uses DOMHighResTimestamp of "time origin" i.e. the created time of the "global object" which is either a Window or a WorkerGlobalScope). To follow that, what we could do here is probably to use the actual time of message creation, subtracted by the "time origin" of IMidiAccess object, which may come from either externals or the instantiation time of it.