How to prevent sending MIDI CC messages on loading the Max for Live device

Sergey Surganov's icon

I'm developing Max for Live device for controlling my pedals with MIDI control messages. I use "ctlout" for CC and "midiformat" for PGM. The problem is that when I load the device (or its preset) in Live, it will fire a bunch of MIDI messages, which is not always a desired behavior. What's the best practice to prevent sending some MIDI messages on loading the device? I had some luck with "change 0" command, but it's not exactly what I'm looking for. "Initial enable" checkboxes are off.

1978.amxd
amxd 102.38 KB
CXM 1978 device file

double_UG's icon

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

Sergey Surganov's icon

Thank you so much, it works for me!

Is there a document I can read that explains Max for Live device's lifecycle? It looks like "live.thisdevice" fires "loadbang" at the very last step, after sending any preset setup MIDI messages. I didn't know about this particular order, and want to learn more.

double_UG's icon

https://forum.ableton.com/viewtopic.php?f=35&t=137593&start=0
https://cycling74.com/forums/initialization-order-inconsistency