Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #39610

Re: setTimeOut and lag adding up.

Newsgroups comp.lang.javascript
Date 2021-03-10 09:01 -0800
References <fe27709a-9283-4972-a47c-a69b248a748cn@googlegroups.com> <1fac7e20-62d5-4b4b-affd-b4c29432d3dan@googlegroups.com>
Message-ID <269fe5c8-674d-49e2-84e7-e3eaefc61770n@googlegroups.com> (permalink)
Subject Re: setTimeOut and lag adding up.
From Jonas Thörnvall <jonas.thornvall@gmail.com>

Show all headers | View raw


onsdag 10 mars 2021 kl. 17:46:38 UTC+1 skrev Jonas Thörnvall:
> onsdag 10 mars 2021 kl. 17:41:11 UTC+1 skrev Jonas Thörnvall: 
> > I have a question i shift some 12 000 note events. 
> > During 5 min 48 seconds. 
> > 
> > That cause ca 30 seconds of lag in the shift sequence of note intervals/timeout lengths. I could understand the delay add up to some 1000 ms, but 30 000????? 
> > 
> > Can that really be reasonable? 
> > What is the main cause of it in this function? 
> > 
> > function doPlayup() { 
> > if (keepGoing) { 
> > if (copyEv.length) { 
> > if (track[playtrack].midiMess[midEvent].data0<192 || track[playtrack].midiMess[midEvent].data0>207){ 
> > noteMessage = [track[playtrack].midiMess[midEvent].data0, track[playtrack].midiMess[midEvent].data1, track[playtrack].midiMess[midEvent].data2]; 
> > } else { 
> > noteMessage = [track[playtrack].midiMess[midEvent].data0, track[playtrack].midiMess[midEvent].data1]; 
> > } 
> > outportarr[outportindex].send(noteMessage); 
> > //pianoKeypressOut(); 
> > waittime = copyEv.shift(); 
> > midEvent++; 
> > setTimeout(doPlayup, waittime); 
> > } else { stopPLAY();} 
> > } 
> > }
> And i do have added up the intervals/timeouts to check they really add up to the 5.48 minutes. 
> But yet last note is played around 6.20 minutes.
I finally find something omitting the timeout?
output.send( [0x80, 60, 0x40], window.performance.now() + copyEv.shift );
Could this work you think?
But how do one wrap such a call, you can't use a loop?

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

setTimeOut and lag adding up. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-03-10 08:41 -0800
  Re: setTimeOut and lag adding up. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-03-10 08:46 -0800
    Re: setTimeOut and lag adding up. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-03-10 09:01 -0800
    Re: setTimeOut and lag adding up. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-03-10 09:31 -0800
      Re: setTimeOut and lag adding up. JJ <jj4public@gmail.com> - 2021-03-11 14:01 +0700
  Re: setTimeOut and lag adding up. Arno Welzel <usenet@arnowelzel.de> - 2021-03-11 12:57 +0100
    Re: setTimeOut and lag adding up. Silvio <silvio@internet.com> - 2021-03-11 14:17 +0100
      Re: setTimeOut and lag adding up. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-03-11 06:07 -0800
        Re: setTimeOut and lag adding up. Silvio <silvio@internet.com> - 2021-03-11 16:03 +0100
          Re: setTimeOut and lag adding up. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-03-11 07:47 -0800
    Re: setTimeOut and lag adding up. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-03-11 05:54 -0800
    Re: setTimeOut and lag adding up. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-03-11 06:13 -0800

csiph-web