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


Groups > comp.lang.javascript > #40083

Re: Serialise setInterval

Newsgroups comp.lang.javascript
Date 2021-05-21 15:12 -0700
References (6 earlier) <a4546b64-623c-45a6-8855-d62083e94e7an@googlegroups.com> <87a6optqde.fsf@bsb.me.uk> <d6379de5-e6cb-4063-9202-447a808fbd31n@googlegroups.com> <ok7dag9hi8ej4avoqmg76fur6vcfil50u6@4ax.com> <12f5b6e6-66c6-4587-a483-f5967411fd39n@googlegroups.com>
Message-ID <640cfe0f-0434-4340-9e2b-d2fa4adea581n@googlegroups.com> (permalink)
Subject Re: Serialise setInterval
From Jonas Thörnvall <jonas.thornvall@gmail.com>

Show all headers | View raw


fredag 21 maj 2021 kl. 00:31:26 UTC+2 skrev Jonas Thörnvall:
> torsdag 20 maj 2021 kl. 19:40:51 UTC+2 skrev John G Harris: 
> > On Thu, 20 May 2021 09:17:37 -0700 (PDT), Jonas Thörnvall 
> > <jonas.t...@gmail.com> wrote: 
> > 
> > <snip> 
> > >A question on a more general topic Ben when one write a programming language "that is parsed" highlevel, do one leave space for add extra parameters for functions? 
> > >If so it seem that we could juat add a switch to setTimeout and setInterval, but they probably do not think that long, that there could be extra parameters that simply discarded in the early versions of the parser. 
> > What you need is C++, C#, or Java. (Same name, different number of 
> > parameters, makes it a different function.) Perhaps you should review 
> > your choice of implementation language. 
> > 
> > John
> No i love the idea of running programs interpreted by the browser, and that is the success story of Javascript, availability.
Ok now i scrutinised my own code and i can not see why it should not work. I only call recSomeNotes one time after the countIn ended.

And if i skip countIn and go direct one recSomeNotes it work without problem.
First i call countIn 8 times?
The 9 time i stop the countIn
And startup recordSomeNotes "just a single time".

What is wrong i do not get it, it should work?
Because doing this directly work?
stopRec=setInterval(recSomeNotes,5);


So what goes wrong in this code?

stopCount=setInterval(countIn,600);

function countIn(){
    if (jint<8){ 
		if (mvol==1 || mvol==noteval+1) { metvol=120; } else { metvol=50;}
		noteMessage = [153, 77, metvol];
		outportarr[outportindex].send(noteMessage);
		ctT.fillStyle = "red";
		ctT.fillRect(240+prog, 5, 10,10);
		prog=prog+15;
		jint++;
		mvol++;
	} else {
		if (rendScroll){
			alert("fuck it");
			clearInterval(stopCount);
			startScrollAnime();
			browserLoadTIME=performance.now();
			stopRec=setInterval(recSomeNotes,5);
		} 
	}
}	

function recSomeNotes(){
		REALTIME=performance.now()-browserLoadTIME;		
		while(REALTIME>schedTime){
			outportarr[outportindex].send(noteMessage[playPos]);
			if (echo && mode=="Play"){ 
				pianoKeypressOut();
			}
			schedTime=copyEv[playPos]+schedTime;
			playPos++;		
		}
		if (playPos>copyEv.length) {stop();}
}

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


Thread

Serialise setInterval Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-05-19 13:05 -0700
  Re: Serialise setInterval Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-05-19 13:42 -0700
    Re: Serialise setInterval Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-05-20 03:00 +0100
      Re: Serialise setInterval Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-05-20 05:20 -0700
      Re: Serialise setInterval Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-05-20 05:22 -0700
      Re: Serialise setInterval Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-05-20 05:25 -0700
        Re: Serialise setInterval Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-05-20 05:28 -0700
          Re: Serialise setInterval Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-05-20 05:36 -0700
            Re: Serialise setInterval Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-05-20 05:43 -0700
              Re: Serialise setInterval Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-05-20 15:46 +0100
                Re: Serialise setInterval Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-05-20 08:13 -0700
                Re: Serialise setInterval Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-05-20 16:52 +0100
                Re: Serialise setInterval Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-05-20 09:11 -0700
                Re: Serialise setInterval Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-05-20 09:17 -0700
                Re: Serialise setInterval John G Harris <niam@jghnorth.org.uk.invalid> - 2021-05-20 18:40 +0100
                Re: Serialise setInterval Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-05-20 15:31 -0700
                Re: Serialise setInterval Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-05-21 15:12 -0700
                Re: Serialise setInterval Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-05-21 15:14 -0700
            Re: Serialise setInterval Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-05-20 05:55 -0700

csiph-web