bang when device is placed in track?

Shawn Boonstra's icon

This is probably a dumb question, but I've always wondered and didn't see an existing topic for it. Is there any device (along the lines of live.thisdevice and loadbang) that bangs when a M4L device is first inserted into a Live track but not every time the containing Live set is opened? I understand live.thisdevice bangs in both cases.

I ask because sometimes I want my device to discover info about the Live set it's been dropped into as part of its initial state (e.g., to populate a menu with all the tracks in the set), but I don't want this process to wipe out the user's changes every time the Live set is opened. Does that make sense?

Brian Henry's icon

That is a great idea for a device if it doesn't already exist.

Not sure if this will work for you, but thinking out loud for a potential work-around:
use a gswitch2 (parameter mode enabled) from 1 to 2 after first live.thisdevice
out 1 would populate the menu with tracks
out 2 would go to another routine (like checking for new devices or checking your track list)

The gswitch2 state saves between sessions and can be automated in Live

Keeping an eye here for others suggestions.

Shawn Boonstra's icon

Thanks Brian. Actually I thought of that shortly after I posted and it seems to work when I test it by itself. It's not giving me the result I want in the patch I had in mind but probably because I screwed something else up somewhere.

So if I didn't enable parameter mode on the gswitch2, would it revert to the left outlet every time I load the Live set? And does the same go for other Max UI things like toggle and number? The documentation on this confuses me because it'll say something like "upon load," and I never know if that means upon opening the Live set, upon dropping the device into a Live track, upon opening the patcher in the Max editor, etc.

Brian Henry's icon

With Parameter Mode Enabled it should always return to the last state it was saved in. Sometimes I'll leave things like gswitch visible in the presentation while I'm troubleshooting to see if everything acting as expected.

Also check this out:
https://cycling74.com/forums/max-console-in-ableton-live

Finally got back to my computer with Max... Give attached a try. I think this is easier to do with a normal Gate device

live.thisdevice sets and bangs through the gate out 1, then sets that all new live.thisdevice bangs will go through gate out 2.

init_toggle.amxd
amxd 4.88 KB