Module clock

clock coroutines

Functions

run (f) create a coroutine from the given function and immediately run it; the function parameter is a task that will suspend when clock.sleep and clock.sync are called inside it and will wake up again after specified time.
sleep (s) yield and schedule waking up the coroutine in s seconds; must be called from within a coroutine started with clock.run.
sync (beats) yield and schedule waking up the coroutine at beats beat; the coroutine will suspend for the time required to reach the given fraction of a beat; must be called from within a coroutine started with clock.run.
stop (coro_id) stop execution of a coroutine started using clock.run.
set_source (source) select the sync source, currently clock.INTERNAL and clock.MIDI.


Functions

run (f)
create a coroutine from the given function and immediately run it; the function parameter is a task that will suspend when clock.sleep and clock.sync are called inside it and will wake up again after specified time.

Parameters:

  • f function

Returns:

    integer : coroutine ID that can be used to stop it later
sleep (s)
yield and schedule waking up the coroutine in s seconds; must be called from within a coroutine started with clock.run.

Parameters:

  • s float : seconds
sync (beats)
yield and schedule waking up the coroutine at beats beat; the coroutine will suspend for the time required to reach the given fraction of a beat; must be called from within a coroutine started with clock.run.

Parameters:

  • beats float : next fraction of a beat at which the coroutine will be resumed. may be larger than 1.
stop (coro_id)
stop execution of a coroutine started using clock.run.

Parameters:

  • coro_id integer : coroutine ID
set_source (source)
select the sync source, currently clock.INTERNAL and clock.MIDI.

Parameters:

  • source integer : clock.INTERNAL (0) or clock.MIDI (1)
generated by LDoc 1.4.6 Last updated 2020-03-28 23:45:19