-
Notifications
You must be signed in to change notification settings - Fork 51
Input Latency upper bound #187
Copy link
Copy link
Open
Labels
Needs DiscussionThe issue needs more discussion before it can be fixed.The issue needs more discussion before it can be fixed.Priority: Eventuallyhttps://speced.github.io/spec-maintenance/about/https://speced.github.io/spec-maintenance/about/category: new featurehttps://www.w3.org/policies/process/#class-4https://www.w3.org/policies/process/#class-4
Milestone
Metadata
Metadata
Assignees
Labels
Needs DiscussionThe issue needs more discussion before it can be fixed.The issue needs more discussion before it can be fixed.Priority: Eventuallyhttps://speced.github.io/spec-maintenance/about/https://speced.github.io/spec-maintenance/about/category: new featurehttps://www.w3.org/policies/process/#class-4https://www.w3.org/policies/process/#class-4
Type
Fields
Give feedbackNo fields configured for issues without a type.
When Recording MIDI Events via
MIDIInput.onmessage, when can I be sure that no more Events withtimeStamp < t0will be emitted?e.g.:
When there are regular Midi Clock Messages on the input, it would be sufficient to wait for the next Clock Message to occur, but this doesn't cover the general case.
Idea:
setTimeout(... , 0)(or similar) to runprocessStoredEvents()function after the currently running JS context has exited, so that the event loop has a chance to dispatch all pending events. But this will only work reliably, when the miditimeStamps are assigned in such a way, that any event withtimeStamp < nowis immediately available to be dispatched (i.e. when a browser uses a separate midi input thread, it MUST make sure, that any midi events timestamped there witht0 < nowwill be dispatched before the setTimeout function is executed).Does the current Web MIDI Standard guarantee this?
Otherwise, these are my thoughts of how the standard could be extended:
it guarantees a fixed upper latency boundary (e.g. 100ms), during which the events are surely delivered.
This does not seem feasible, as a running JS context can delay the execution of
onmidimessagearbitrarily.there is some way to request a "synchronisation" on the input, i.e. onmidimessage is executed with an "empty" event that contains the "current input
timeStamp" (and there is some ordering guarantee, i.e. midi events are delivered with monotonically increasing timeStamps).MIDIInputis extended to contain the "current input timeStamp", similiar to the synchronisation case.What do you suggest?