Functions
Time

Time mainpulation functions. More...

Functions

function run (fun,...)
 launch a function in a separate parallel execution thread. More...
 
function spawn (fun,...)
 launch a function in a separate parallel execution thread. More...
 
function waitBeat (beat)
 suspend the current thread callback execution for the given number of beats. More...
 
function wait (ms)
 suspend the current thread callback execution for the given number of samples. More...
 
function waitForRelease ()
 suspend the current thread callback execution until the note that created this callback is released either by the pedal or by a note off. More...
 

Detailed Description

Time mainpulation functions.

Function Documentation

function spawn ( fun  ,
  ... 
)

launch a function in a separate parallel execution thread.

the function execution will is defered at the end of the current 'instant'

Parameters
funfunction to launch
...variable number of arguments to pass to the function
function print_n_times(n, waitingTime)
for i=1,n do
print("time", getTime(), "print_n_times", i)
wait(waitingTime)
end
end
spawn(print_n_times, 3, 1000)
print("time", getTime(), "end of spawn")
function run ( fun  ,
  ... 
)

launch a function in a separate parallel execution thread.

execute it immediately, then goes back to the caller thread once the thread waits for something

Parameters
funfunction to launch
...variable number of arguments to pass to the function
function print_n_times(n, waitingTime)
for i=1,n do
print("time", getTime(), "print_n_times", i)
wait(waitingTime)
end
end
run(print_n_times, 3, 1000)
print("time", getTime(), "end of run")
function waitBeat ( beat  )

suspend the current thread callback execution for the given number of beats.

Parameters
beatthe number of beats to wait, has to be greater than 0
See Also
wait, waitForRelease, waitSecond
Examples:
monoBassLine.lua.
function wait ( ms  )

suspend the current thread callback execution for the given number of samples.

It allows other thread callbacks to be resumed in between. The thread scheduler is sample-accurate.

Parameters
msthe number of milliseconds to wait, has to be greater than 0
See Also
waitForRelease, waitBeat
Examples:
Ensemble.lua, portamento.lua, tremolo.lua, and vibrato.lua.
function waitForRelease ( )

suspend the current thread callback execution until the note that created this callback is released either by the pedal or by a note off.

See Also
wait, waitSecond, waitBeat