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.


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.


-- locate the first MIDI module in the program and print its name
module = this.program:getMidiModule()

if module then
    print("Could not find a MIDI module!")

See Also: getBusgetChild, getEffect, getLayergetSlot, getZone, MidiModule