MIDI song position pointer, and code optimization

    Jan 26 2011 | 4:05 am
    I'd like to implement code to extract MIDI song position pointer information out of a MIDI input stream. I've written the code to do so (the messages are 3 bytes long, and start with decimal 242) - see below (the bytes are just printed to the Max window).
    My question: does anyone have a better, more efficient way to capture these three bytes out of the incoming MIDI stream? For some reason, something tells me that I'm doing this in a more clunky fashion than I need to, and I'm having a mental block!
    Thanks in advance...

    • Jan 26 2011 | 12:01 pm
      @dan not sure if that's more efficient, that's a few objects less.
    • Jan 26 2011 | 12:57 pm
      I think vanille's solution is perfect. Maybe a bit less efficient, but that does it really matter when processing midi?
    • Jan 26 2011 | 6:57 pm
      Thanks to you guys for the two solutions! Both much cleaner and nicer than mine...
    • Jan 26 2011 | 10:35 pm
      Ultimately though there should be an object for this - it is a standard system midi message, so it should only need minor editing of existing code , cheers
    • May 23 2014 | 9:27 am
      Just another one:
      and yes, a seperate object for MTC and SPP would definitely be handsome...
    • May 23 2014 | 11:01 am
      That's beautiful Stefan, one object!