Page 1 of 1

EOS - Can I use setInterval

Posted: Tue May 18, 2021 6:34 pm
by boundupone
I am trying to automatically ramp volume over the course of a tease. I have a var set -

Code: Select all

var teaseramps = (volend - volstart) / teasetime
This works by taking the user choices of start volume, end volume and tease time to calculate % increases needed per minute of playing to get to the end target volume

However, I am having issues getting setInterval to work -

Code: Select all

var myInterval; 

myInterval = setInterval(whichFunction,60000);

whichFunction{volume = volume + teaseramps
}
It doesnt seem to matter if I put it in an eval or announce, it just isn't playing

Can anyone help or give me a better way to achieve what I want?

Re: EOS - Can I use setInterval

Posted: Tue May 18, 2021 6:58 pm
by Ghingis
Afaik there is no setInterval in EOS, but you can check this out, it might help.

viewtopic.php?p=301829#p301829

Re: EOS - Can I use setInterval

Posted: Tue May 18, 2021 8:12 pm
by boundupone
Ghingis wrote: Tue May 18, 2021 6:58 pm Afaik there is no setInterval in EOS, but you can check this out, it might help.

viewtopic.php?p=301829#p301829
Hey thanks, but not sure if that one helps me much, but maybe I am missing something?

Re: EOS - Can I use setInterval

Posted: Tue May 18, 2021 11:31 pm
by fapnip
boundupone wrote: Tue May 18, 2021 8:12 pm but maybe I am missing something?
Probably missed that the aforementioned demo uses my setTimeout and setInterval polyfills extensively.

There's no setInterval in Eos natively, but I wrote a polyfill for it that emulates setInterval and setTimeout using sound end events.

See:
viewtopic.php?p=301725#p301725

As explained in the polyfill thread, you'll need the first IF action in the start page (and all its contents -- including all of the Audio play actions) along with the silent MP3.

If you're having issues with it, let me know! (Preferably, post any issues/questions on the polyfill in the polyfill thread.)

Re: EOS - Can I use setInterval

Posted: Wed May 19, 2021 9:47 am
by boundupone
Ah, thanks. Will be a couple of days before I can look at this but will let you know how it goes

Re: EOS - Can I use setInterval

Posted: Wed May 19, 2021 3:18 pm
by fapnip
To simplify use, I've created a fadeTo extension for Eos's Sound object.

See:
viewtopic.php?f=2&t=24081

Re: EOS - Can I use setInterval

Posted: Thu May 20, 2021 6:02 pm
by boundupone
Thanks guys, having some issues still so will post on the polyfil thread