resolume / OSC parsing nightmare

snerk4000's icon

trying to deal with getting a single piece of information out of resolume arena's completely insane OSC implementation.

basically, when you start a video you get, for example:

/layer5/clip3/connect 1

Max Patch
Copy patch and select New From Clipboard in Max.

is there a simple way to match that exact string, and just pass the 5 and 3 through as ints? my solution right now is complete garbage and requires far too much OSC filtering, but i wasn't sure where to start really:

any help is appreciated!

-a

jamesson's icon

This is an expr problem. If max regexp documentation is not to your taste there is extensive documentation in teh interwebz. Be aware that max expr may have unique features/lack thereof.

snerk4000's icon

... this is why i shouldn't have posted code.

expr has nothing to do with what i'm asking about.

filtering the OSC messages down to one that i want is the problem, i want to do that long before i hit expr

jamesson's icon

Expr will do what you want

Either find a way to select numbers or simply count the number of symbols from the left up to the one you need and grab it.

PS - didnt even look at the patch

Luddy's icon

If by chance all of the OSC you are receiving is formatted like the above, then you might try using regexp to replace for example layer5/ by layer/5/, then do to the usual replacement of / by single space before using route to parse the OSC. In other words, change the input string so that the numbers look like an OSC address component rather than a suffix on an identifier. Something like "regexp ([0-9]*)/ @substitute /%1/" -- but I probably have the syntax wrong -- before the usual regexp / @substitute " ", then "route layer" "route 1 2 3 4 5" etc. to parse the OSC. Hope that makes sense.

-Luddy

spectro's icon

I was going to suggest CNMAT's OSC-route would be useful to you till I saw you were 'using' it. Didn't actually register the *real*problem here

jamesson's icon

I think we must question the statement "any help is appreciated!". No offense...

spectro's icon
Max Patch
Copy patch and select New From Clipboard in Max.

This seems to get most of what you need via regexp. Anything more than cursory testing not included.

broc's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Or just use a single regexp like this.

snerk4000's icon

broc, that's the jam. thank you.

spectro: yours works until you get to high layers, anything with 2 digits and they start to run together.

jamesson: expr only deals with numbers that i can tell... so FYI when i first read "this is an expr problem", it had already been giving me errors when getting fed strings of letters from other stray osc messages. so it actaully WAS a problem.

sorry for not being smart and having to be frustrated and struggle through code, i guess you never went through that.

jamesson's icon

I did get frustrated and struggle, and you can see that on this very forum :). However, I did not complain about answers I did not like :).

That said, I humbly apologize to you and everybody for confusing expr and regexp. That was a pretty big booboo.