Program for Code Examples
If not stated otherwise, the following simple program will be sufficient for exploring the code examples in HALion.
- Download the program Explore Code Examples.vstpreset
- Drag the program to the Slot Rack.
This describes how you create the program manually.
- Select an empty program in the Program Table.
- In the Program Tree, click Create New MIDI Module and select Lua Script.
- In the Program Tree, click Create New Zone and select Synth Zone.
- Load the program to the Slot Rack.
This is how your program should look like in the program tree.
Loading the Code Examples
The program described above should be loaded in the Slot Rack.
- Open a page with a code example, for example, onNote.
- Double-click the code example to select all lines and press Ctrl/Cmd-C to copy the code to the clipboard.
- Go to HALion and select Lua Script in the Program Tree.
- Open the section for the Lua Script MIDI module, either in the Sound or in the MIDI Modules editor.
- Click Edit Script to open the internal Script Editor.
- Give the Script Editor the window focus and press Ctrl/Cmd-V to paste the code from the clipboard.
- Click OK to activate the script.
Depending on the code example, you usually have to play a note or send a MIDI controller to get a sound or output message from the script. Typically, the description of the feature and the comments in the code will give you enough hints for what to do. In the above example, onNote prints the note ID, the MIDI note number and the MIDI velocity, each time you play a note.