Strange message ordering

    Dec 22 2009 | 4:03 am
    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:
    midiin midiparse 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 next track: < -- print which happens before subpatch is called disarm: path live_set visible_tracks 5
    So it's like the whole top level .amxd patch is executed and then the .maxpats are executed 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.
    The button with the problem is huge and red.

    • Dec 22 2009 | 5:04 pm
      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,
    • Dec 24 2009 | 3:50 pm
      Thanks so much nick - appreciate the help. It's unfortunate none of this in mentioned in the message ordering tutorial.
    • Dec 24 2009 | 3:53 pm