/ HALion Developer Resource / HALion Script / Reference /

getMidiModule

getMidiModule(nameOrPosition)

Description

Function to retrieve the MidiModule object of a MIDI module in the specified layer. For example, this.parent defines the parent layer of the script module as the layer to be searched in. This function does not search in sublayers. A particular MIDI module can be searched by name or position. The position is the number indexing the MIDI modules in the specified layer. If several MIDI modules share the same name, only the first match will be returned. If no argument is set, the function returns the first MIDI module it finds.

Available in: Controller, Processor.

Arguments

ArgumentDescriptionValue Type
nameOrPositionThe name or position of the MIDI module. Set this to nil to deactivate the search filter.string or number, optional

Return Values

Returns the MidiModule object of the found MIDI module. Returns nil if no MIDI module is found.

Example

-- Locate the first MIDI module in the program and print its name.

module = this.program:getMidiModule()
 
if module then
    print(module.name)
else
    print("Could not find a MIDI module!")
end

See also: getBus, getChild, getEffect, getLayer, getSlot, getZone, MidiModule