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

wait(ms)

Description

Function to suspend the execution of a callback for a specific time in milliseconds.

If the wait function is used in the Controller thread, it operates at a lower rate and is therefore less accurate.

Available in: Controller, Processor.

Arguments

msTime in ms.number

Example

-- delay notes which have not been released for 1000 ms
local initTime = getTime()
local releaseTime = {}

function onNote(event)
  local noteOnTime = getTime()
  wait(1000)
  if noteOnTime > (releaseTime[event.note] or initTime) then
    postEvent(event)
  end
end

function onRelease(event)
  releaseTime[event.note] = getTime()
  postEvent(event)
end

3 Comments

  1. I had to change something. Please check again.

     

    To find out what has changed: The Page History of Confluence allows you to compare the latest versions of this page.