/ HALion Developer Resource / HALion Script / Reference /

waitForRelease

waitForRelease()

Description

Function to suspend the execution of the onNote callback until the note that called onNote gets released either by a corresponding note-off or sustain pedal off.

Available in: Processor.

Example

-- Print the note length in milliseconds.

function onNote(event)
    postEvent(event)
    local noteOnTime = getTime()
    waitForRelease()
    local noteOffTime = getTime()
    local noteLength = noteOffTime - noteOnTime
    print(noteLength.." ms")
end

See also: wait, waitBeat, spawn, runAsync, runSync