Go Back   Cockos Incorporated Forums > REAPER Forums > MIDI Hardware, Control Surfaces, and OSC

Reply
 
Thread Tools Display Modes
Old 04-15-2012, 07:58 AM   #1
Banned
Human being with feelings
 
Banned's Avatar
 
Join Date: Mar 2008
Location: Unwired (probably in the proximity of Amsterdam)
Posts: 4,868
Default Re: using action numbers as identifiers for OSC control surface messages

(Split end from another thread, see here, there, and there)

Quote:
Originally Posted by diversgens View Post
[...] Warning: the midiaction will not fit your id depending on theme and action added. [...]
Wait, what? Are (midi)action numbers not reliable identifiers?

Quote:
Originally Posted by diversgens View Post
I really don't know Banned, i hope they are but because i have had some custom midi action i have not compare my id with the default id. [...]
Quote:
Originally Posted by gofer View Post
Just caught this by coincidence and am not sure whether it's resolved in this thread.

Action numbers (in any action list context) are only reliable identifiers across different installs for inbuilt stock Reaper actions. For both, custom actions and extension actions, you need to use the Custom Id string instead of the Cmd Id number, as the Cmd Id's are dynamically applied to them at Reaper startup.

Use the function NamedCommandLookup to translate Custom Id to the current Cmd Id.
In Reascript it would look like

Code:
Create_CClane =  RPR_NamedCommandLookup('_S&M_MECREATECCLANE')
RPR_Main_OnCommand(Create_CClane, 0)
[...]
Thanks gofer! Good thing you stumbled on it. Serendipity FTW.

In the context of OSC control surfaces, I don't see how to do such a thing, unfortunately.

So far, I have only relied on stock REAPER actions myself (and avoided them wherever OSC 'actions' are available because they support feedback, while actions don't). But this is definitely an issue that needs to be addressed in order to achieve (full) compatibility with custom actions and extension actions.

I still haven't played with ReaScript yet (it's on my seemingly *endless* to-do list ), but perhaps there's a way to combine ReaScripting with OSC control surface support to tackle such issues. Still, I think it would be preferable to deal with them without resorting to ReaScripting. I'm not sure until I actually try of course, and I have no objection to using ReaScript, but it just seems to me that the appropriate place to deal with this for OSC control surfaces is in the specification / configuration for OSC control surfaces themselves. Perhaps we should just think of an appropriate FR to extend OSC control surface support - I don't yet have any ideas on that. To anyone concerned, please chime in with your ideas and thoughts. Especially if you rely on custom / extension actions!
__________________
˙lɐd 'ʎɐʍ ƃuoɹʍ ǝɥʇ ǝɔıʌǝp ʇɐɥʇ ƃuıploɥ ǝɹ,noʎ
Banned is offline   Reply With Quote
Old 04-15-2012, 08:44 AM   #2
gofer
-blänk-
 
gofer's Avatar
 
Join Date: Jun 2008
Posts: 11,159
Default

First off, I don't know whether all this is a problem for OSC action binding at all. Someone should put it to a test. I can only tell what I know about triggering actions from ReaScript. In case someone goes in and uses "Add shortcut" in the action list and binds to an OSC message it should work alright, but I can imagine there are problems when someone shares OSC layouts (is that the right term here?) which use custom and extension actions bound to OSC by using CMD Id.


A bit more about the ReaScript side, maybe something applies:
Using custom actions is actually not a good idea with ReaScript (if it's to be shared), as the Custom Id string Reaper generates when you create a custom action will not be the same for any two users creating the same custom action. I think the Custom Id string will be the same if user B imports a *.ReaperKeymap file with the custom action user A shared, but I am not even sure there. So while for extension actions the Custom ID is hand coded by the developers and reliably the same for all users this does not apply to custom actions.

The way to deal with custom actions in Reascript is straightforward: don't use them. You just let the script trigger the individual actions the macro would consist of. Basically rebuilding the custom action. I don't know whether this is possible with the OSC implementation (trigger multiple actions in a row with a single command) but would think so.

What the solution for extension actions would be in the OSC domain (if it's a problem), I don't know. If you can't do NamedCommandLookup(Custom ID string) to find out the Cmd ID of the action in the current install, the first thing I would try is trigger the extension action with the custom ID string. Maybe they implemented a sort of automatic NamedCommandLookup function (which I would like to see for ReaScript as well, then ).

Last edited by gofer; 04-15-2012 at 08:55 AM.
gofer is offline   Reply With Quote
Old 05-02-2012, 05:25 PM   #3
Banned
Human being with feelings
 
Banned's Avatar
 
Join Date: Mar 2008
Location: Unwired (probably in the proximity of Amsterdam)
Posts: 4,868
Default

I may have figured out a practical workaround for triggering a limited set of actions with unreliable action IDs in a more reliable manner: it involves making toolbar buttons for them, (selecting the toolbar and then) triggering the toolbar button using the dedicated actions for this purpose (which are native actions, and thus have reliable IDs). That way we can use the number of available toolbars multiplied by the number of toolbar buttons that can be triggered via an action. Unfortunately, only actions for the first 16 buttons are supported. It would be nice if this number could be raised a little bit (and not only as a workaround for this particular issue).

Of course, custom toolbar buttons can not be relied upon not to change between installs of different users and so on, and it needs some additional configuration, but at least it seems to take the unreliability of custom action IDs out of the equation.
__________________
˙lɐd 'ʎɐʍ ƃuoɹʍ ǝɥʇ ǝɔıʌǝp ʇɐɥʇ ƃuıploɥ ǝɹ,noʎ
Banned is offline   Reply With Quote
Old 05-03-2012, 02:48 AM   #4
Banned
Human being with feelings
 
Banned's Avatar
 
Join Date: Mar 2008
Location: Unwired (probably in the proximity of Amsterdam)
Posts: 4,868
Default

More general discussion of this issue in this thread.
__________________
˙lɐd 'ʎɐʍ ƃuoɹʍ ǝɥʇ ǝɔıʌǝp ʇɐɥʇ ƃuıploɥ ǝɹ,noʎ
Banned is offline   Reply With Quote
Old 04-24-2014, 11:27 AM   #5
EricM
Human being with feelings
 
EricM's Avatar
 
Join Date: Jul 2009
Location: Ljubljana, Slovenia
Posts: 3,801
Default

Hi,

I've just installed TouchOSC and researched the whole
OSC protocol implementation on both ends, and I still
cannot find a solution to reliably recall non-native
action using Custom ID via OSC.

Is there no way to call that string directly from the
remote control app or using some kind of a lookup function
or manual definition in the .ReaperOSC file?

Maybe a way to call a phyton script through OSC that
would perform the lookup, if OSC parameter can be
passed to the script?

It's seems completely unreasonable to not have static IDs
for non-native functions, as the dynamic IDs will ALWAYS
change by any update of reaper, extensions, or changes in
user actions.

Any new insight on the subject greatly appreciated.

e
__________________
Shoelace 4 Theme | SoundCloud/erXon
EricM is offline   Reply With Quote
Old 04-24-2014, 12:02 PM   #6
EricM
Human being with feelings
 
EricM's Avatar
 
Join Date: Jul 2009
Location: Ljubljana, Slovenia
Posts: 3,801
Default

OK nevermind, I found a simple solution:

I've set the OSC message to whatever I want, for example
'/loadtrack/slot/01' which I than learn to my custom macro
that loads track template at slot 01 (but also unarms all
tracks before doing so), this way the ID calling is not
needed, and mapping is always static.

e
__________________
Shoelace 4 Theme | SoundCloud/erXon
EricM is offline   Reply With Quote
Old 04-24-2014, 02:42 PM   #7
Banned
Human being with feelings
 
Banned's Avatar
 
Join Date: Mar 2008
Location: Unwired (probably in the proximity of Amsterdam)
Posts: 4,868
Default

Quote:
Originally Posted by EricM View Post
[...] I still
cannot find a solution to reliably recall non-native
action using Custom ID via OSC.

Is there no way to call that string directly from the
remote control app [...]
Hi Eric,

I'm not sure about TouchOSC specifically, but sending a string with a Custom ID should work, using this OSC 'action description' in the .ReaperOSC config file:
Code:
ACTION s/action/str
For example, if for some custom action, REAPER would have assigned Custom ID "_972d01de92474c04889cd9bbbdf8c8d5", to trigger the action I send a message like this:
Code:
/action/str [s] _972d01de92474c04889cd9bbbdf8c8d5
Quote:
Originally Posted by EricM View Post
It's seems completely unreasonable to not have static IDs
for non-native functions, as the dynamic IDs will ALWAYS
change by any update of reaper, extensions, or changes in
user actions.
Afaik, the 'Cmd ID' is 'dynamic' (i.e. subject to change between installs), but the 'Custom ID' is static.

Hope this helps...
__________________
˙lɐd 'ʎɐʍ ƃuoɹʍ ǝɥʇ ǝɔıʌǝp ʇɐɥʇ ƃuıploɥ ǝɹ,noʎ
Banned is offline   Reply With Quote
Old 04-24-2014, 09:17 PM   #8
EricM
Human being with feelings
 
EricM's Avatar
 
Join Date: Jul 2009
Location: Ljubljana, Slovenia
Posts: 3,801
Default

Quote:
Originally Posted by Banned View Post
Code:
/action/str [s] _972d01de92474c04889cd9bbbdf8c8d5
Ahh so that is the proper syntax. I'll try it out asap.

I've read and reread the implementation descriptions but couldn't figure it out
:/ I really think a simpler guide with better examples is needed somewhere.

I still don't quite understand what the definitions in .ReaperOSC do exactly,
and how must a certain type of message be formed to be understood properly.

Quote:
Originally Posted by Banned View Post
Afaik, the 'Cmd ID' is 'dynamic' (i.e. subject to change between installs), but the 'Custom ID' is static.
Correct, I guess I just had an issue with the syntax :>

Quote:
Originally Posted by Banned View Post
Hope this helps...
If the example syntax works, it's exactly it Thank you!

e
__________________
Shoelace 4 Theme | SoundCloud/erXon
EricM is offline   Reply With Quote
Old 04-24-2014, 10:39 PM   #9
EricM
Human being with feelings
 
EricM's Avatar
 
Join Date: Jul 2009
Location: Ljubljana, Slovenia
Posts: 3,801
Default

Quote:
Originally Posted by Banned View Post
Code:
/action/str [s] _972d01de92474c04889cd9bbbdf8c8d5
Hey, I've just tried it with this syntax with the custom ID
of my custom action, and nothing happens.

Could you help me understand the need for 'str' and '[s]'
parameters? In my custom ReaperOSC file I have a definition
for actions copied from the default one:

Code:
ACTION i/action s/action/str t/action/@ f/action/@/cc
and it does not feature any brackets. I've also tried various
other combinations as such:
/action/str _b1aab146dd185e40b7717166d97bc5a9
/action/_b1aab146dd185e40b7717166d97bc5a9
/action/"_b1aab146dd185e40b7717166d97bc5a9"
s/action/str _b1aab146dd185e40b7717166d97bc5a9
None of them work.

Calling the dynamic Cmd Id as such works, but
of course is not reliable.
/action/54965
e
__________________
Shoelace 4 Theme | SoundCloud/erXon
EricM is offline   Reply With Quote
Old 04-25-2014, 04:09 AM   #10
Banned
Human being with feelings
 
Banned's Avatar
 
Join Date: Mar 2008
Location: Unwired (probably in the proximity of Amsterdam)
Posts: 4,868
Default

Quote:
Originally Posted by EricM View Post
Hey, I've just tried it with this syntax with the custom ID
of my custom action, and nothing happens.

Could you help me understand the need for 'str' and '[s]'
parameters? In my custom ReaperOSC file I have a definition
for actions copied from the default one:

Code:
ACTION i/action s/action/str t/action/@ f/action/@/cc
and it does not feature any brackets.
The relevant one there is this one:
Code:
ACTION s/action/str
Note that at the time of the original post, we only had these ones (for use with the numeric Cmd ID ) :
Code:
ACTION i/action t/action/@
So, the pattern with the string flag seems to have been added later specifically for triggering actions using (Custom ID) strings.

The brackets aren't literally part of the message, sorry if that was confusing. I used a 'type flag' in brackets only to indicate the data type of the value sent, like you would also see when using the 'Listen...' function in REAPER's Control Surface Settings window to monitor incoming OSC messages.

For example, a value of "1" could be a integer, float, or string; while looking the same to humans it's a bit different to computers. So "[i] 1" means "1, formatted as an int", "[f] 1" means "1, formatted as float, and "[s] 1" means "1, formatted as a string".
Quote:
Originally Posted by EricM View Post
I've also tried various
other combinations as such:
/action/str _b1aab146dd185e40b7717166d97bc5a9
/action/_b1aab146dd185e40b7717166d97bc5a9
/action/"_b1aab146dd185e40b7717166d97bc5a9"
s/action/str _b1aab146dd185e40b7717166d97bc5a9
None of them work.
Not sure if this works for TouchOSC, but perhaps try putting quote marks around the value:
Code:
/action/str "_b1aab146dd185e40b7717166d97bc5a9"
__________________
˙lɐd 'ʎɐʍ ƃuoɹʍ ǝɥʇ ǝɔıʌǝp ʇɐɥʇ ƃuıploɥ ǝɹ,noʎ
Banned is offline   Reply With Quote
Old 04-25-2014, 05:23 AM   #11
EricM
Human being with feelings
 
EricM's Avatar
 
Join Date: Jul 2009
Location: Ljubljana, Slovenia
Posts: 3,801
Default

Quote:
Originally Posted by Banned View Post
I used a 'type flag' in brackets only to indicate the data type of the value sent, like you would also see when using the 'Listen...' function in REAPER's Control Surface Settings window to monitor incoming OSC messages.
Ah now we're getting somewhere. I guess there's an issue
with how to force TouchOSC to send the string type value,
instead it is sending the string as a parameter name and
additionally 1 & 0 as on/off float values, which of course
does not trigger the action.

If I'm reading this right... :>



I only have these parameters available in the TouchOSC Editor
for the button.



Have to figure out how to fix it on the TouchOSC end than...

Thanks for the pointer!

e
__________________
Shoelace 4 Theme | SoundCloud/erXon
EricM is offline   Reply With Quote
Old 04-25-2014, 05:48 AM   #12
EricM
Human being with feelings
 
EricM's Avatar
 
Join Date: Jul 2009
Location: Ljubljana, Slovenia
Posts: 3,801
Default

Bah, I found this thread (no idea how it eluded me 'till now):
http://forum.cockos.com/showthread.php?t=132124

Xane002 had exactly the same issue, and as he points out, TouchOSC
is not capable of sending string as an argument. So unless Cockos
gives us an ability to use string as a parameter with integer value
a whole set of remote controllers will not be able to trigger custom
commands, without learning them.

I was really hoping to solve this so I can get the regular buttons
in TouchOSC to work, now I have to use Toggle buttons with disabled
local feedback state, as normal buttons send both ON & OFF message,
triggering the action twice - which is not desired.

So much frustration and workarounds over a task that should really
be simple

e
__________________
Shoelace 4 Theme | SoundCloud/erXon
EricM is offline   Reply With Quote
Old 04-25-2014, 06:05 AM   #13
Banned
Human being with feelings
 
Banned's Avatar
 
Join Date: Mar 2008
Location: Unwired (probably in the proximity of Amsterdam)
Posts: 4,868
Default

Quote:
Originally Posted by EricM View Post
Ah now we're getting somewhere. I guess there's an issue
with how to force TouchOSC to send the string type value,
instead it is sending the string as a parameter name and
additionally 1 & 0 as on/off float values, which of course
does not trigger the action.

[...]

Have to figure out how to fix it on the TouchOSC end than...
Yes, that seems to be an issue on TouchOSC (Editor)'s end, which currently does not seem to be capable of allowing you to send string type parameter values. Somehow you should be able to enter the Custom ID string as a (parameter) *value*. But the 'Value Range' fields only accept signed floating point. So it seems you're stuck with having to use some kind of workaround. Sounds like a good FR for TouchOSC though?
__________________
˙lɐd 'ʎɐʍ ƃuoɹʍ ǝɥʇ ǝɔıʌǝp ʇɐɥʇ ƃuıploɥ ǝɹ,noʎ
Banned is offline   Reply With Quote
Old 04-25-2014, 06:31 AM   #14
Banned
Human being with feelings
 
Banned's Avatar
 
Join Date: Mar 2008
Location: Unwired (probably in the proximity of Amsterdam)
Posts: 4,868
Default

Quote:
Originally Posted by EricM View Post
[...] an ability to use string as a parameter with integer value [...]
I don't get what you exactly mean there. A parameter value (formally: "argument") is either of the string type, or some other type such as int or float.

Perhaps you mean something like using the Custom ID string as part of the *address* pattern, as we can do with the Cmd ID's numeric values using the "t/action/@" OSC action description?
Quote:
Originally Posted by EricM View Post
a whole set of remote controllers will not be able to trigger custom
commands, without learning them.
I think "a whole set of remote controllers" is a bit of an overstatement, as it would only take one update to TouchOSC to fix this issue. Which other apps are there that can't do this? I've used OSC with many different apps / frameworks, and most of them can do this just fine.

Hexler / TouchOSC should just fix this on their end, imho.
Quote:
Originally Posted by EricM View Post
I was really hoping to solve this so I can get the regular buttons
in TouchOSC to work, now I have to use Toggle buttons with disabled
local feedback state, as normal buttons send both ON & OFF message,
triggering the action twice - which is not desired.
But, what's the problem with having to use toggle buttons? We are not getting any feedback for actions from REAPER anyway, so I don't see how you would be able to use that any differently, even if string type parameter values were supported in TouchOSC.
__________________
˙lɐd 'ʎɐʍ ƃuoɹʍ ǝɥʇ ǝɔıʌǝp ʇɐɥʇ ƃuıploɥ ǝɹ,noʎ

Last edited by Banned; 04-25-2014 at 06:40 AM.
Banned is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 04:27 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.