cwilso / WebMIDIAPIShim

Polyfill using the Jazz NPAPI MIDI plugin to implement the Web MIDI API on Mac and Windows.
380 stars 53 forks source link

Delaying the output play #30

Closed nfroidure closed 10 years ago

nfroidure commented 11 years ago

Hi,

It have an issue with sending datas to an output. Since the polyfill use setTimeout, when you send a big amount of datas in the same tick, it can take a few seconds.

So a lot of timeouts are fired directly when the current tick is finished. You can experiment this issue by going in this test page : http://rest4.org/github/nfroidure/MidiFile/master/tests/index.html (source: https://github.com/nfroidure/MidiFile/blob/master/tests/index.html )

One way to avoid this could be to store datas when using send and program only one timeout that would begin to send datas progressively and asynchronously.

Thanks for reading.