Reverse of sprintf? / Converting formatted message from string

Aug 20, 2013 at 8:46pm

Reverse of sprintf? / Converting formatted message from string

Hello, well this is infuriatingly simple but I cannot come up with any ideas perhaps due to my limited understanding of sprintf / C+

I have a M4L patch pasted below where I want to trigger a bang when a formatted message crosses a threshold. I am successfully doing this but I’m curious if it is possible another way…

In this case I want to know if I can take a message in the format hour:min:sec:ms like 00:00:30:000 and unpack that the way fromsymbol works with a message like “blah yah boo.” Am I insane or are these colons a problem? I’ve looked at regex too but cannot get that to work. The doc on sprintf below suggests sscanf is what I’m looking for perhaps, but in the Max world?

http://www.cplusplus.com/reference/cstdio/sprintf/

As always, thanks for any help on informing me of what an idiot I am.

C

– Pasted Max Patch, click to expand. –
#259480
Aug 21, 2013 at 12:00am

You can hit it from two angles.. Either create a list from the sprintf’d format with regexp or bypass the sprintf formatting and output a secondary list of time values from the subpatch. In either case, sel isn’t gonna hack it. match is the ticket.

-

– Pasted Max Patch, click to expand. –

-

– Pasted Max Patch, click to expand. –
#259488

You must be logged in to reply to this topic.