Strange message ordering
I have a patch that:
1. disarms the current track
2. moves to the next track
3. arms the new track
These actions are arranged right to left off a Live.button in the proper order.
When clicking the button with the mouse, the actions happen in the expected order.
When I route a midinote in this way:
route 27 (note pitch)
route 100 (note vel)
…and use my midi controller to send a note, this happens:
disarming: bang < -- print which happens before subpatch is called
arming: bang < -- print which happens before subpatch is called
arm: path live_set visible_tracks 4 < -- inside subpatch
next track: < -- print which happens before subpatch is called
disarm: path live_set visible_tracks 5 < -- inside subpatch
So it’s like the whole top level .amxd patch is executed and then the .maxpats are executed afterward…in left to right order.
Like I said though, this only happens when I use a midi note, which I strip all data off with route and am sending a band to the button (which i saw with the monitor). When control clicking the button, it works fine.
If you’d like to see the patch, it’s here: http://www.samgreene.com/drupal_samgreene/files/LinearAbleton.amxd
The button with the problem is huge and red.
as explained in multiple threads over at ableton forums, LiveAPI calls are not necessarily behaving in the same way as native max objects when it comes to message ordering (rather to be compared with asynchronous network calls).
The reason for your behaviour is that any user interaction (such as pressing a max button) will automatically take place in the low-prio thread. MIDI inputs, osc messages etc. (which ultimately also represent user activity…most likely) will be processed in the default thread though.
without going into more details, try putting a "deferlow" object between your midi input and the rest of the patch, should solve the problem. Besides this, reducing LiveAPI calls (e.g. live.path by storing id’s locally) is always a good thing to do.
hope it helps,
Thanks so much nick – appreciate the help. It’s unfortunate none of this in mentioned in the message ordering tutorial.
Seems to be a good article on the subject.