- Live Versions: 9
- Operating System: ALL
So far, we have seen how to navigate the LOM to find our way to a parameter.
Next, we saw how we can use these directions to ask for a unique parameter ID from live.path.
We then saw how to use this ID to control the parameter using live.object and to listen to it using live.observer.
There is still a final point in the LOM that we have not covered, namely function calls to the API.
We will use these combined with what we have learned so far to build our second patch, a Max for Live Clip Launcher.
Select Clip Slot
As in the previous lessions, we will consult the LOM to work out a path to the clip_slot.
The only difference is that this time, we wish to be able to select which Clip to launch.
To achieve this, we will use replaceable arguments again as in Lesson 2. Just to briefly recap, this means instead of tracks 0 clip_slots 0, we will use tracks $1 clip_slots $2. Thus, by sending values to the messages, $1 will be replaced by the first value we send and $2 will be replaced by the second value.
This is a good moment to remind ourselves about the indexing with Live's API. The first Track will be tracks 0, the second, tracks 1 and so on.
This works out to be the following path message:
path live_set tracks $1 clip_slots $2
By using $1 and $2 instead of numbers in the message, we can hook up controls that will allow us to choose which clip_slot to trigger.
The packobject simply bundles the track and clip slot numbers and feeds them together as a list into the message.
When looking at the Live Object Model, you may have noticed that there is a functions section further down the page.
These functions allow you to easily implement a number of operations, for example launching clips, inserting tracks, re-sizing the grid, inserting devices, etc.
For this patch, we will use the Clip object's fire function.
Once we have set the live.object with a valid ID, we can call the associated functions for the addressed object by sending a message to it.
In this case, we will send the message call fire, where fire is the name of the function.
Exactly as in the last lesson, we pass the ID generated by live.path to live.object. We can now call the fire function by sending the message call fire to the live.object. This will trigger the clip slot.
If there is a clip in this slot, it will be launched. If the slot is empty and the track-record armed, a clip will be created and recording will begin, otherwise it stops the playing clip in that track.
Note: Looking to the right side of the patch, we notice something useful. When we feed a path message into live.path that doesn’t exist (for example track 5 where there are only 4 tracks in the project), live.path returns ID 0.
In this 3-part lesson, we have covered:
- How to use the Live Object Model to obtain a path to parameters in Live
- How to use this path in the live.path, live.object and live.observer objects to get an ID for the desired parameter and thus to control and observe this parameter.
- How to use function calls to the API (in this case, we used this to "fire" Clips)
- How Max message ordering works
This knowledge will allow you to start building Max for Live devices to control elements in Live.
To learn more about Max for Live, we highly recommend this series of Max for Live tutorials.
The Max for Live forum is also a great place to share ideas and get help from the Max community with your patches.