EventLoop is the base class for several XLoop classes that can record any kind of events (such as note events, controller events from gesture capturing, key presses etc) and play them back flexibly. It aims to unify earlier such classes like CtLoop (in the GamePad quark), KeyPlayerRec (in the KeyPlayer quark), and others.
EventLoop records events as
Its subclasses add features:
KeyLoop - events by keys
- event has time and single key as ID for events, e.g. char of keystroke on a computer keyboard, and a lookup dict of functions what to do for each key.
KtlLoop - lists of key/value pairs
- single func, all set e.g. a specific proxy to new settings; it can rescale parameter values by shift, scale, invert.
AutoLoop - still to be done, records movements of one slider as an semi-autonomous loop.
make a new instance, with a key and a function to evaluate on playback.
the key of the EventLoop
a taskproxy for playback of recorded list
the function to evaluate when playing back for each recorded event
the current list of recorded events
get and set verbosity level for debugging. 0 is off.
start recording. if instant = true, recording starts instantly; otherwise, recording will start with the first recorded event.
record a new event into the list. event will consist of [abstime, deltatime ] ++ ... args provided
stop recording
toggle recording on/off
flag whether EventLoop is currently recording
get current absolute and delta recording times
add the current list to the lists, e.g. after recording.
store current list and clear for recording
play the recorded events using the taskproxy
pause and resume the playback taskproxy
stop the playback taskproxy
toggle between play and stop
flag whether internal taskproxy is playing
get and set flag whether playback loops.
get and set playback tempo
get and set where in (normalized) range of list event playback starts
get and set which length in (normalized) range of list event playback to use
startPos + length, position in normalized range where playback ends or loops
get and set how much playback event order should jitter.
get and set how much playback index moves at each step. 1 = forward.
set step to +1
set step to -1
flag whether playback is reversed
reverse playback direction
reset loop playback params to default
quantize recorded delta times for playback
quant |
the quant to round absolute times to |
totalDur |
the duration to set the full duration to |
reset delta times to unquantized state
the recorded lists. first is newest list.
print indices and sizes of the current lists
set current list to one of the stored lists, by index.
get the current list duration
get the last index of current list
get the index of the current list in lists
get the number of recorded lists
print the lists in readabe form