Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #35713
| Newsgroups | comp.lang.javascript |
|---|---|
| Date | 2018-09-26 23:46 -0700 |
| References | (1 earlier) <ddf8f6a7-bea8-4ecd-848c-e3a529b7d657@googlegroups.com> <379d95fc-4644-472a-b5c2-da40c19985b8@googlegroups.com> <47a829d4-1ae2-4b76-aa9a-52ca467138b7@googlegroups.com> <a895a7c1-1a78-4272-a61a-0d9042110570@googlegroups.com> <2775bf2c-ed06-468e-9876-9f13d169d24f@googlegroups.com> |
| Message-ID | <d11025c2-c49f-4903-ab0a-cc3c282925df@googlegroups.com> (permalink) |
| Subject | Re: Howto break selfreferensing loops "inbound maybe it is called?" |
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
Den torsdag 27 september 2018 kl. 08:28:27 UTC+2 skrev Jonas Thörnvall:
> Den torsdag 27 september 2018 kl. 08:23:08 UTC+2 skrev Jonas Thörnvall:
> > Den torsdag 27 september 2018 kl. 08:03:04 UTC+2 skrev Jonas Thörnvall:
> > > Den torsdag 27 september 2018 kl. 08:01:14 UTC+2 skrev Jonas Thörnvall:
> > > > Den torsdag 27 september 2018 kl. 04:46:04 UTC+2 skrev Michael Haufe (TNO):
> > > > > Jonas Thörnvall wrote:
> > > > > > if (copyEv.length) {
> > > > > > if (playmidi==false) { break; }//***Get error message
> > > > > > noteMessage = [track[0].midiMess[midEvent].data0, track[0].midiMess[midEvent].data1, track[0].midiMess[midEvent].data2];
> > > > > > outportarr[outportindex].send(noteMessage);
> > > > > > var waittime = copyEv.shift();
> > > > > > midEvent++;
> > > > > > setTimeout(doPlayup, waittime);
> > > > > > }
> > > > > >
> > > > > >
> > > > > > ***Uncaught SyntaxError: Illegal break statement
> > > > >
> > > > >
> > > > > You've failed the Turing Test.
> > > >
> > > > No the ***stop*** test i passed by.
> > > > copyEv.length=0;
> > > > It is the ***pause*** test that is alot harder.
> > > > I tried to set waittime to some high value and was thinking that it would resume from pause once i set it back or to zero. But it does not.
> > > >
> > > > If you have any smart idea howto pause the loop tell me, because when i set pause waittime to 30000000, and later try resume by setting it to 0, copyEv.length for some to me unknown reason zero.
> > > > http://anybase.co.nf/index.html
> > >
> > > Oops shit happens when you copy and rename, unknown reason not so unknown...
> > >
> > > unction pauseplay(){
> > > console.log("pauseplay");
> > > savewait=waittime;
> > > waittime=300000000;
> > > ****copyEv.length=0;****
> > > mode="Pause";
> > > listMainSetting();
> > > }
> >
> > But then it will not pause...
>
> Anyone have a good idea for howto **pause** the loop in doPlayup() from pauseplay()
>
> function doPlayup() {
> if (copyEv.length) {
> noteMessage = [track[0].midiMess[midEvent].data0, track[0].midiMess[midEvent].data1, track[0].midiMess[midEvent].data2];
> outportarr[outportindex].send(noteMessage);
> waittime = copyEv.shift();
> midEvent++;
> setTimeout(doPlayup, waittime);
> } else {stopplay();}
> }
>
> function pauseplay(){
> mode="Pause";
> listMainSetting();
> console.log("pauseplay");
> savewait=waittime;
> waittime=3000.0
> }
Solved! nicely?
function doPlayup() {
if(keepGoing){
if (copyEv.length) {
noteMessage = [track[0].midiMess[midEvent].data0, track[0].midiMess[midEvent].data1, track[0].midiMess[midEvent].data2];
outportarr[outportindex].send(noteMessage);
waittime = copyEv.shift();
midEvent++;
setTimeout(doPlayup, waittime);
} else {stopplay();}
}
}
function stopplay(){
console.log("stopplay");
copyEv.length=0;
mode="Listen";
listMainSetting();
}
function pauseplay(){
mode="Pause";
listMainSetting();
console.log("pauseplay");
savewait=waittime;
keepGoing=false;
}
function resumeplay(){
keepGoing=true;
console.log("resumeplay");
mode="Play";
listMainSetting();
waittime=savewait;
console.log("wait",waittime,"copyEV_length",copyEv);
setTimeout(doPlayup, waittime);
}
Back to comp.lang.javascript | Previous | Next — Previous in thread | Find similar | Unroll thread
Howto break selfreferensing loops "inbound maybe it is called?" Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-25 14:39 -0700
Re: Howto break selfreferensing loops "inbound maybe it is called?" Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-25 15:50 -0700
Re: Howto break selfreferensing loops "inbound maybe it is called?" Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-26 00:19 -0700
Re: Howto break selfreferensing loops "inbound maybe it is called?" Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-26 01:06 -0700
Re: Howto break selfreferensing loops "inbound maybe it is called?" "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2018-09-26 19:45 -0700
Re: Howto break selfreferensing loops "inbound maybe it is called?" Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-26 23:01 -0700
Re: Howto break selfreferensing loops "inbound maybe it is called?" Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-26 23:02 -0700
Re: Howto break selfreferensing loops "inbound maybe it is called?" Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-26 23:23 -0700
Re: Howto break selfreferensing loops "inbound maybe it is called?" Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-26 23:28 -0700
Re: Howto break selfreferensing loops "inbound maybe it is called?" Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-26 23:46 -0700
csiph-web