Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #34952
| Newsgroups | comp.lang.javascript |
|---|---|
| Date | 2018-04-30 18:44 -0700 |
| References | (1 earlier) <4qa10u801489.jvohomgjs5av$.dlg@40tude.net> <c55279ed-34c0-4d51-9805-a9c19984555f@googlegroups.com> <pc7sml$h0n$1@dont-email.me> <9cc97d1c-9625-47c0-9fa4-acbc3a8f4a19@googlegroups.com> <8b31acbd-5858-4496-9698-4aaf934ff452@googlegroups.com> |
| Message-ID | <809123f9-7988-438e-baf0-9c79ce06f3e0@googlegroups.com> (permalink) |
| Subject | Re: Bad timing |
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
Den tisdag 1 maj 2018 kl. 03:32:27 UTC+2 skrev Jonas Thörnvall:
> Den tisdag 1 maj 2018 kl. 03:25:00 UTC+2 skrev Jonas Thörnvall:
> > Den måndag 30 april 2018 kl. 22:01:32 UTC+2 skrev Chris M. Thomasson:
> > > On 4/30/2018 12:24 AM, Julio Di Egidio wrote:
> > > > On Monday, 30 April 2018 05:43:13 UTC+2, JJ wrote:
> > > >> On Sun, 29 Apr 2018 17:27:27 -0700 (PDT), Jonas Thörnvall wrote:
> > > > <snip>
> > > >>> setTimeout(doPlayup, waittime);
> > > >>> }
> > > >>> }
> > > >>
> > > >> You should do that in a worker thread
> > > >
> > > > There are no threads in JavaScript.
> > >
> > > Fwiw:
> > >
> > > https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers
> > >
> > > http://funwithfractals.atspace.cc/ct_root/ct_ui
> > >
> > > The work is computed using another thread and the UI remains responsive.
> >
> > Well i found the problem of the slipping notes "bad programming of events", but it is good to know howto find a solution that is more accurate under rendering.
> >
> > I do not quite understand shift() i guess it remove first item in array.
> >
> > It seem the last note "timing" in array is removed before the last call, what is the solution to this problem?
> >
> > I am just used to work with loops, these backcalls with shift() are confusing.
>
> last note never reached?
> Because i never reach last timing in array copyEv, i guess i remove it before "i should" do the last call to doPlayup?
>
> I've been thinking for two days now and i do not see howto resolve it.
> But there must be a standard solution handling this? I can't see it.
>
> doPlayup();
>
> function doPlayup() {
> if (copyEv.length) {
> var waittime = copyEv.shift();
> if(pyp>-1) {
> noteOnMessage = [track[tracknr].midiMess[pyp].data0, track[tracknr].midiMess[pyp].data1, track[tracknr].midiMess[pyp].data2];
> output.send(noteOnMessage);
>
> }
> document.getElementById("keystream").value+=waittime+"\n";
> pyp++;
> setTimeout(doPlayup, waittime);
> }
> }
The last midiMess is never played i guess it is inherent to the use of
if array.length and shift()
And if i do write if (copyEv.length+1), it play last but i get undefined which i guess is from try to shift something that isn't there.... Correct?
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Bad timing Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-04-29 17:27 -0700
Re: Bad timing JJ <jj4public@vfemail.net> - 2018-04-30 10:43 +0700
Re: Bad timing Julio Di Egidio <julio@diegidio.name> - 2018-04-30 00:24 -0700
Re: Bad timing "Chris M. Thomasson" <invalid_chris_thomasson@invalid.invalid> - 2018-04-30 13:01 -0700
Re: Bad timing Julio Di Egidio <julio@diegidio.name> - 2018-04-30 17:04 -0700
Re: Bad timing Julio Di Egidio <julio@diegidio.name> - 2018-05-01 04:33 -0700
Re: Bad timing Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-04-30 18:24 -0700
Re: Bad timing Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-04-30 18:32 -0700
Re: Bad timing Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-04-30 18:44 -0700
Re: Bad timing "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2018-05-01 10:29 +0200
Re: Bad timing Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-05-01 14:48 -0700
Re: Bad timing Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-05-01 14:54 -0700
Re: Bad timing Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-05-01 22:12 -0700
Re: Bad timing "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2018-05-02 11:29 +0200
Re: Bad timing Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-05-03 23:35 -0700
Re: Bad timing Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-05-03 23:38 -0700
Re: Bad timing Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-05-03 23:53 -0700
Re: Bad timing Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-05-04 00:49 -0700
Re: Bad timing Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-05-01 23:11 -0700
Re: Bad timing Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-04-30 00:43 -0700
Re: Bad timing Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-04-30 00:47 -0700
Re: Bad timing Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-04-30 06:20 -0700
csiph-web