View Single Post
Old 04-16-2014, 08:27 AM   #83
Human being with feelings
Banned's Avatar
Join Date: Mar 2008
Location: Unwired (probably in the proximity of Amsterdam)
Posts: 4,868

Originally Posted by Veto View Post
But i can only get it to work from track 1-8, probably only a config thing.
Originally Posted by Veto View Post
[...] values equivalent to the selected track number (currently only between 1-8, has something to do with the Track Bank i feel)
Yes, probably. In the .ReaperOSC configuration file you use (*not* the Default.ReaperOSC file !!!), change the number of tracks that make up a 'bank':
... to something like:
(or more, if you're that kind of guy. )
Originally Posted by Veto View Post
I was wrong, string to int conversion is not needed. [...]
Hmm, the workaround you use (looking at the 'binary' message patterns) sort of works, but not in corner cases (e.g. with multiple selected tracks, unselecting the last selected track, it does not show the last selected track anymore...). I figure it would needs something like a stack to remember the order in which tracks have been selected to make it bug-proof.

But, in any case, I still would like to know how to get an integer value from a numeric parameter value sent as a string... because that's also what I want to do in OSCII-bot (v0.2) scripts, but I can't seem to figure out how to do so.

As with LugNut/Veto's example above, the more general issue is that REAPER's OSC Console Surface feature outputs some important *numeric* values as *strings*: e.g. last selected track number, track bank number, parameter bank number, last touched effect track number, last touched effect slot number. (Afaik we're not able to get these numbers as int (or float) values directly. This seems to be by design; I would suppose it is to accommodate displaying the values in e.g. OSC control apps for touch screen devices. Perhaps I should also request some enhancements to the OSC Control Surface implementation, but I guess that's a separate issue...)

Can anyone show some simple example code for OSCII-bot that extracts an int value from a string (which contains only that value), sent as parameter of an OSC message by REAPER? For example, for this action description / pattern (as in Default.ReaperOSC):
TRACK_NUMBER s/track/number/str
There are some comments in Justin's sample_script.txt example (included in OSCII-bot v0.2 download) which seem relevant:
// oscparm(x,v) will get parameter value x, setting v to $'f', $'i', $'s', or 0 if invalid, etc. if $'s', you can get individual chars from the string using ((str_offs<<16) + parm_idx)
... which seems to be what I need, but I can't seem to figure out how to actually use this to extract an int value from a parameter which is (formatted as) a string. Can anyone give a little demonstration?

Originally Posted by Justin View Post
[...] in pre9 you can now embed/extract raw (and optionally big-endian) ints/shorts/floats/doubles as floats as well... [...]
I guess OSCII-bot does not have something like this (yet)?
˙lɐd 'ʎɐʍ ƃuoɹʍ ǝɥʇ ǝɔıʌǝp ʇɐɥʇ ƃuıploɥ ǝɹ,noʎ
Banned is offline   Reply With Quote