Re: [Web MIDI API] send() timestamp

OK, I pulled in a lot of the structural protection changes, and the
performance.now polyfill, and tested on Chrome/FF/Safari on OSX.


On Sun, Dec 16, 2012 at 1:05 AM, Marcos Caceres <marcos@marcosc.com> wrote:

>
>
>
> On Saturday, 15 December 2012 at 15:04, Marcos Caceres wrote:
>
> > Ok, I think I'm getting it now :) I'll try to set up a little experiment
> and see if I can replicate the above (though it won't really work in the
> reference implementation as we are still relying on setTimeout for
> scheduling... which only has a precision of 4ms)
>
> Ok, got it all going :)
> http://marcoscaceres.github.com/WebMIDIAPIShim/
>
> So, to replay a recording made locally, it's basically:
> //pre-recorded data
> var record=[{data:[...], stamp: 123113}, … ];
>
> //time playback relative to "now"
> var start = window.performance.now() - record[0].stamp;
> record.forEach(function(packet){
> output.send(packet.data, packet.stamp + start);
> })
>
>
>
> I also polyfilled performance.now() for various browsers. See bottom of:
> http://marcoscaceres.github.com/WebMIDIAPIShim/WebMIDIAPI.js
>
> Hopefully that all looks about right now (bar the changes I made to API to
> make it easier to use… which I hope you will consider).
>
> --
> Marcos Caceres
> http://datadriven.com.au
>
>
>
>

Received on Tuesday, 18 December 2012 19:23:43 UTC