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


Groups > comp.lang.javascript > #36984

Re: How can i make a timer process "not run in a thread"

Newsgroups comp.lang.javascript
Date 2019-07-24 01:39 -0700
References <cbc9c416-3787-4c40-a779-5ac55bfdf841@googlegroups.com> <9ff89f6d-5d3e-4c7b-a66f-48c262e631a6@googlegroups.com> <6e9eaf29-f9f8-42d8-8fba-602f69214756@googlegroups.com>
Message-ID <f40864e7-e401-4f32-8bf0-d352d0b0eba9@googlegroups.com> (permalink)
Subject Re: How can i make a timer process "not run in a thread"
From Jonas Thörnvall <jonas.thornvall@gmail.com>

Show all headers | View raw


Den onsdag 24 juli 2019 kl. 10:34:10 UTC+2 skrev Jonas Thörnvall:
> Den onsdag 24 juli 2019 kl. 10:31:30 UTC+2 skrev Jonas Thörnvall:
> > Den onsdag 24 juli 2019 kl. 10:21:51 UTC+2 skrev Jonas Thörnvall:
> > > This is a countin before the timer reset and metronome and recording starts.
> > > As you can see i initita the record "and playup" as i have aborted the countin".
> > > I really do not want it that way i want two sequential calls first one to the countin and then one that init play and rec.
> > > 
> > > I guess that setInterval is the only way to call with intervals, problem for me is it run in a thread so anything i run after setInterval will immediately be executed, if i not start it after i aborted the countIn?
> > > 
> > > I am totally unfamiliar with threads and this type of problem, so what is the easiest way to get the countin interval and recording interval to be exectuted sequential. countINREC() -> initPlayREC
> > > 
> > > 
> > > 
> > > //COUNTIN RECORDING
> > > function countInREC() {
> > >   //Count In metronome
> > >   echostate=document.getElementById("echo").checked;
> > >   document.getElementById("echo").checked = false;
> > >   checkIfEchoMessage();
> > >   console.log("recInit activetrack=" + activetrack);
> > >   if (document.getElementById("recordmode").value == "REPLACE") {
> > >     removeTrackMessages(activetrack);
> > >   }
> > >   beats = 1;
> > >   mode = "Count In";
> > >   document.getElementById("status").value = mode;
> > >  // listLeftCanvas();
> > >   countticks = setInterval(countInTimer, interval);
> > > }
> > > 
> > > function countInTimer() {
> > >   var metvol;
> > >   if (met == 1) {
> > > 	  metvol=127;
> > >       metcall(metvol);
> > >   } else {
> > > 	  metvol=50;
> > >       metcall(metvol);
> > >   }
> > >   if (met == 4) {
> > >     met = 0;
> > >   }
> > >   if (beats == 8) {
> > >     abortCountin();
> > >   }
> > >   met++;
> > >   beats++;
> > > }
> > > 
> > > function abortCountin() {
> > >   // Stop countin
> > >   clearInterval(countticks);
> > >   initPlayREC();
> > > }
> > 
> > I realise i could do something like.
> > function initREC(){
> > countIn();
> > setTimeout(initPlayREC,xxxx);
> > }
> > 
> > But for me that also just feel weird, i want the execution sequential but how?
> > 
> > }
> 
> Well personally i think setTimeout should have a flag for run in thread or single threaded but that is me.

Sorry setInterval

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


Thread

How can i make a timer process "not run in a thread" Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-07-24 01:21 -0700
  Re: How can i make a timer process "not run in a thread" Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-07-24 01:31 -0700
    Re: How can i make a timer process "not run in a thread" Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-07-24 01:34 -0700
      Re: How can i make a timer process "not run in a thread" Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-07-24 01:39 -0700
  Re: How can i make a timer process "not run in a thread" Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-07-24 01:49 -0700
    Re: How can i make a timer process "not run in a thread" Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-07-24 01:50 -0700
      Re: How can i make a timer process "not run in a thread" Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-07-24 01:53 -0700
        Re: How can i make a timer process "not run in a thread" Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-07-24 01:54 -0700
          Re: How can i make a timer process "not run in a thread" Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-07-24 01:56 -0700
            Re: How can i make a timer process "not run in a thread" Arno Welzel <usenet@arnowelzel.de> - 2019-07-24 13:46 +0200
              Re: How can i make a timer process "not run in a thread" Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-07-24 08:06 -0700
              Re: How can i make a timer process "not run in a thread" Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-07-27 07:38 -0700
                Re: How can i make a timer process "not run in a thread" Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-07-27 07:39 -0700

csiph-web