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


Groups > comp.lang.javascript > #39842

Re: setTimeout to a negative value?

Newsgroups comp.lang.javascript
Date 2021-04-02 01:52 -0700
References (1 earlier) <izdznoye9yb0.vmckgo8hl0ln$.dlg@40tude.net> <7c3bbc9d-29ae-4843-ba0f-afb5301544fan@googlegroups.com> <d19941f7-f92e-41fb-9add-e953a3349e9cn@googlegroups.com> <170fecfe-4b8e-49eb-801a-7c4498202fcan@googlegroups.com> <b7edfc54-a20c-453b-8ffb-7f2fcba21871n@googlegroups.com>
Message-ID <b42384b7-6576-484c-b1ef-5bc7832affe2n@googlegroups.com> (permalink)
Subject Re: setTimeout to a negative value?
From Jonas Thörnvall <jonas.thornvall@gmail.com>

Show all headers | View raw


fredag 2 april 2021 kl. 10:50:14 UTC+2 skrev Jonas Thörnvall:
> torsdag 1 april 2021 kl. 22:44:22 UTC+2 skrev Jonas Thörnvall: 
> > torsdag 1 april 2021 kl. 21:30:01 UTC+2 skrev Jonas Thörnvall: 
> > > torsdag 1 april 2021 kl. 20:59:29 UTC+2 skrev Jonas Thörnvall: 
> > > > torsdag 1 april 2021 kl. 17:16:59 UTC+2 skrev JJ: 
> > > > > On Thu, 1 Apr 2021 06:49:55 -0700 (PDT), Jonas Thörnvall wrote: 
> > > > > > Will it be handled like zero? 
> > > > > Am I a moron? 
> > > > I do not see what is so moronic with my question you can have a time calculation where the "latency" to big and note to close, so next note come up having a negative time sign right? 
> > > > 
> > > > timeEv[playPos]=timeEv[playPos]-(performance.now()-browserLoadTIME-passedTime); 
> > > > 
> > > > passed time is the scheduled time 
> > > > performance -loadtime is the realtime clock 
> > > > We could end up with a negative timeEv "because of latency". 
> > > Maybe Math.abs() should be use but it could be a waste of computation power? 
> > https://jonasth.github.io/ 
> > Anyone with good temporal and spatial abilities "logic", that can correct "my scheme to correct the note time", "check URL for realtime, animationtime and notetime" 
> > Otherwise i think i have to make a time diagram and travel back in time. 
> > 
> > Prove your IQ and ability :), by helping me out. Because this could potentially show up on next job interview or IQ test you do LoL 
> > Imagine time 0 enter the function. "performanc.now()-browserLoadTIME" 
> > 
> > function STARTPLAY(){ 
> > if (keepGoing) { 
> > stopRec=setTimeout(STARTPLAY,copyEv[playPos]); 
> > //While still notes 
> > if (playPos<copyEv.length) { 
> > //******THIS CODE WILL CORRECT, THE FUTURE TIMING OF NEXT EVENT ***IN THE FUTURE 
> > //The realtime that passed is performance.now()-browserLoadTIME 
> > //The scheduled time is the note timings passedTime=copyEv[playPos]+passedTime; 
> > //Realtime-scheduledtime is our latency. 
> > //calculate latency=performance.now()-browserLoadTIME-passedTime; 
> > //calculate new position copyEv[playPos]=copyEv[playPos]-latency; 
> > passedTime=copyEv[playPos]+passedTime; 
> > copyEv[playPos]=copyEv[playPos]-(performance.now()-browserLoadTIME-passedTime); 
> > outportarr[outportindex].send(noteMessage[playPos]); 
> > playPos++; 
> > if (echo && mode=="Play"){ 
> > pianoKeypressOut(); 
> > } 
> > 
> > } else { stop();} 
> > } 
> > } 
> > 
> > As a bonus i will declare the guy who solve it the next smartest guy on this NG ;)
> Oh i forgot please help me out, this is heavy to do without timing diagrams get my head spinning. You really want to force me use pencil and paper.....
https://www.youtube.com/watch?v=j1BNcSBApOU

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


Thread

setTimeout to a negative value? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-01 06:49 -0700
  Re: setTimeout to a negative value? JJ <jj4public@gmail.com> - 2021-04-01 22:16 +0700
    Re: setTimeout to a negative value? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-01 11:59 -0700
      Re: setTimeout to a negative value? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-01 12:29 -0700
        Re: setTimeout to a negative value? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-01 13:44 -0700
          Re: setTimeout to a negative value? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-01 13:45 -0700
          Re: setTimeout to a negative value? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-02 01:50 -0700
            Re: setTimeout to a negative value? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-02 01:52 -0700
  Re: setTimeout to a negative value? Jon Ribbens <jon+usenet@unequivocal.eu> - 2021-04-01 15:59 +0000
  Re: setTimeout to a negative value? Silvio <silvio@internet.com> - 2021-04-02 17:36 +0200
    Re: setTimeout to a negative value? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-02 09:13 -0700
      Re: setTimeout to a negative value? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-03 03:04 -0700
  Re: setTimeout to a negative value? Arno Welzel <usenet@arnowelzel.de> - 2021-04-03 16:57 +0200
    Re: setTimeout to a negative value? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-03 21:25 -0700
      Re: setTimeout to a negative value? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-06 12:06 -0700

csiph-web