/ HALion Developer Resource / HALion Script / Reference /

AlternateData Table

(Since HALion 6.4.10)

Description

The alternations in the Alternation List of the Layer Alternate MIDI module are managed through a predefined table: the AlternateData table. This table can be obtained by making a call to getParameter with "AlternateData" as parameter. The alternations are referenced by their index. Each alternate has the fields .keyswitch and .layer. You can change the values, but the structure of this table must remain unaltered. The values are set by making a call to setParameter. See the example below for more details.

Available in: Controller.

Fields

FieldDescriptionValue Type
.keyswitchKey switches allow you to switch to a particular layer. You set the key switch with the corresponding MIDI note number . Set this to -1 to deactivate the keyswitch.number
.layerThe layer for the alternation is defined by the corresponding Layer object.Layer

Example

-- Add a Layer Alternate MIDI module.
this.parent:appendMidiModule(MidiModule("Layer Alternate"))
layerAlternate = this.parent:getMidiModule("")
layerAlternate:setName("Layer Alternate")
altdata = layerAlternate:getParameter("AlternateData")
-- Create three layers with a synth zone and add them to the alternation list.
for i = 1, 3 do
    this.parent:appendLayer(Layer())
    local alternateLayer = this.parent:getLayer(i)
    alternateLayer:setName("Alt "..i)
    alternateLayer:appendZone(Zone())
    local zone = alternateLayer:getZone()
    zone:setName("Zone "..i)
    altdata[#altdata+1] = { keyswitch = -1, layer = alternateLayer }
end
layerAlternate:setParameter("AlternateData", altdata)