Requestchannelpressure( function ), Time(), Requesttimedcallback( interval, function ) – Expert Sleepers MIDI & OSC Scripting v1.1.0 User Manual

Page 11: Requestperiodiccallback( interval, function ), Canceltimer( timer )

Advertising
background image

requestChannelPressure( function )

Request that the given function be called in response to a MIDI channel pressure (after-
touch) event. E.g.

local function handleChannelPressure( channel, value )

-- do stuff

end
requestChannelPressure( handleChannelPressure )

time()

Returns a value in seconds. The value itself is not particularly meaningful, but if you call it
twice and subtract the two values you will have the time interval between the two calls.
E.g.

time1 = time()

-- do stuff

time2 = time()
print( "elapsed time", time2-time1 )

requestTimedCallback( interval, function )

Requests that the given function should be called after interval seconds. Returns a timer
object that can be passed to cancelTimer() (see below). E.g.

local function timerTimeOut()

print( "it is now 2 seconds later" )

end
requestTimedCallback( 2.0, timerTimeOut )

requestPeriodicCallback( interval, function )

Requests that the given function should be called every interval seconds. Returns a timer
object that can be passed to cancelTimer() (see below). E.g.

local function timerCallback()

print( "tick" )

end
requestPeriodicCallback( 1.0, timerCallback )

cancelTimer( timer )

Cancels a timer that was created with requestTimedCallback() or requestPeriodicCall-
back(). After this call the timer object is no longer valid and should not be used. E.g.

timer = requestPeriodicCallback( 1.0, timerCallback )

-- timer is now firing every second

cancelTimer( timer )
timer = nil

Advertising