Page tree
Skip to end of metadata
Go to start of metadata

postEvent(event, delay)

Description

Function to post the event to the engine. The second argument is optional. It allows you to delay the event by a specific time in milliseconds.

Available in: Processor.

Arguments

event
delay

Return Values

Returns a note ID in case of a note-on event, nil for any other type of event. For this reason, assigning the return value of postEvent to a variable is only meaningful in the onNote callback.

Example

local delayTime = 1000

-- post event and print note ID
function onNote(event)
	local id = postEvent(event, delayTime)
	print("ID: "..id)
end
 
-- post event and print note ID
function onRelease(event)
    postEvent(event, delayTime)
    print("ID: "..event.id)
end

-- post event, then print controller number and value
function onController(event)
	postEvent(event)
	print("Controller #: "..event.controller..", Value: "..event.value)
end

1 Comment