Pause, Wait, Sleep?
Is there a way to pause the execution of a script for a given number of milliseconds? I want to play note in a loop when two keys are held but there doesn't seem to be a function to slow down the script.
Pausing a script like in KONTAKT is not possible, but there are two options how to handle stuff in the future:
- Add a time stamp to generated messages
- Use the onTimer callback.
I think for your use case the second option suits better. If you give me more information, I could sketch out an example script for you.
Allowing the user to yield callbacks introduces all kinds of problems so I'd like to avoid adding this.
I'd forgotten about the timer callback, I think it will do the job perfectly.
Is there a way to alter the timer frequency on the fly?
Synth.startTimer() changes the speed and can be called at any time (even in the onTimer callback itself)
Thanks, really easy :)