Simple max puzzle...


    Jun 01 2006 | 3:13 am
    So I'm trying to determine something that seems at first glance very
    simple -- the order of two paired events. The problem is, I want the
    recognition of the pairs to start over each time a pair is
    recognized. So if I click:
    left right left right
    I want it to see: left-to-right left-to-right
    right now it sees: left-to-right right-to-left left-to-right
    Not sure how to Max this... If togedge accepted a set or clear
    message I could see how to do it... A starting place is below.
    Thanks for your help!
    -dh
    --

    • Jun 01 2006 | 4:53 am
      Here's an example of doing it with buddy. Buddy is a really useful
      object for syncing things. (note that buddy does not accept bangs,
      however.) The advantage of using buddy is that it always waits for the
      second button to be pressed.
      Peter McCulloch
    • Jun 01 2006 | 7:47 pm
      Here's a js version that takes any input including bangs and lists.
      max v2;
      /****** save as inlet_order.js ******/
      autowatch = 1;
      inlets = 2;
      var tracker = new Array();
      function anything ()
      {
      switch (inlet)
      {
      case 0 :
      tracker[tracker.length] = 0;
      break;
      case 1 :
      tracker[tracker.length] = 1;
      }
      if (tracker.length==2)
      {
      if (tracker[0]==tracker[1]) tracker.length = 1; // same inlet 2x in a row
      else
      {
      if (tracker[0]else outlet(0, 1); // right to left
      tracker = [];
      }
      }
      }