Issue with Open GL context name and initiation of device in Ableton Live

Mauro Trotta's icon

Hi! I am creating a series of M4L devices that use the same open gl context name. The context name is made out of the track id where the devices are sitting. I have a device that I call "source" which is the one with the jit.world, and when I place this device alone in a track in Ableton, the jit.world window have the name of the context correct, and when I add the other devices to the same track, they all project into the same jit.world window. The problem comes when I close ableton project and open it again, then the jit.world window have a u<random number> type of name. I delete the other devices and the problem is solved. I can´t figure out why that is happening. I attached the source device and the other 2 devices patch.

Max Patch
Copy patch and select New From Clipboard in Max.
Max Patch
Copy patch and select New From Clipboard in Max.
Max Patch
Copy patch and select New From Clipboard in Max.

TFL's icon

Sadly I couldn't reproduce. I exported the source patch and one of the two others as M4L devices, put them in a Live set. Name of source jit.world matches drawto of gl objects in the other module, all fine. I save the Live set, close and re-open, and name and drawto are still correctly set.

Maybe it has something to do with the ordering of your devices in the track, and/or order of execution in general.

A few things to try (these are just wild guess intuitions):

  • put your source device all the way to the left in your track devices? at least left from your other video M4L devices

  • enable jit.world only after its name has been set

  • I doubt the following will have any effect, but just in case: in the two other modules, add an extra delay to set the drawto's (make sure that the jit.world is named and running before setting the drawto of other objects)

Mauro Trotta's icon

Thanks for your reply. In my case, it works fine randomly. It works when I delete the devices and place them again in the track. Could you explain how to "enable jit.world only after its name has been set"? I guess there´s something going on related to that because, sometimes when I load the project, the first thing that appears is the jit.world window and the name on top of it is first is u<random number> and then, when the project load completely, is gl_(track id).

I am also confuse with the use of deferlow: in the max documentation is advice to use it in between live.path and live.objects, but in this device I am developing, I think is convenient that certain messages get read first than others, like the jit.wortld name, for example.

Also, I am starting to use jit.pworld to test each module device individually inside the patch area, so I don´t have to close the patch and try in ableton live. I can't tell if it is a problem when I use jit.world in the source device and I also use jit.pworld in the other devices, and all of them have the same name context.

Sorry for the mess, I just want to figure out the source of the issue on my devices :)

TFL's icon

Could you explain how to "enable jit.world only after its name has been set"?

Remove "@enable 1" from your [jit.world], and use [trigger] to sequence messages in the order you want. Something like [t b i] will first send the received integer to its right outlet (use it to set the world name), then the bang will be out from the left outlet (use that to send a "enable 1" message to your world). In Max (and programming in general), messages never happen at the same time, they always come one after the other. [trigger] (shortcut as [t]) is your best friend to ensure messages come in the desired order.

Mauro Trotta's icon

In Max (and programming in general), messages never happen at the same time, they always come one after the other.

What happens then when there are several devices loaded in a track in ableton live and the ableton project is open? Messages in the patch of those devices are read one device after the other in a specific order?

TFL's icon

What happens then when there are several devices loaded in a track in ableton live and the ableton project is open? Messages in the patch of those devices are read one device after the other in a specific order?

Basically yes. I don't know if there is a determined loading order between tracks and between devices though, but you might be able to figure this out yourself by printing the device id (or place in the track) using [live.thisdevice] + [print], and see in which order they come up on the console.

Regarding Max itself, the initialization order is specified here in the doc. One thing that isn't specified though is ordering within a given patch: loadbangs in the lower right corner will be triggered before the ones closer from the upper left corner (and after any loadbang in any subpatcher of that patch).

Mauro Trotta's icon

In case someone is having a similar issue than mine, I find out that the jit.pworld I was using inside the other devices that had no jit.world object (that I was using to test the patch without closing it) those need it to have a different name context in order to place several copies of the device in the ableton track and not colliding with the context name of the "source" device with the jit.world. Otherwise it will not work once the ableton project is closed and reopened again. I notice the messages in the max console, delete those context name for the jit.pworld and it worked out well after that. Hope it helps someone.