Text widget - target

Hi, for some widgets (rotary, text) I would like to use different ports (send & receive) than default. I thought I might use the "target" value for that reason. It seems that this only works for send but not receive ?

  1. if the widget target doesn't work that way - how would I need to build a script ?
  2. and what could be the purpose of a target value in a text widget ?

Kind regards, mj

1 Like

The target determine the destination of the messages sent by the widgets. The target has an impact on how widgets receive midi messages as well.

See General mechanics - Open Stage Control

Hi Jean-Emmanuel, thank you for the feedback. I tried different things - but putting a different ip:port address in the target value of a text widget seems not to work here. Although I see outgoing osc messages in the Hexler Protokol app. But I see no incoming messages in the OSC Launcher log nor in the text widget itself ?

For example I'm sending: /fxparam/1/name "name">
text widget:
target =
value: OSC{/fxparam/@{parent.variables.n}/name, ---}

It works perfectly when I put the port 9010 in the Launcher.

Regards, mj

You don't need to set a specific target for the widget if you just want to receive osc message, it has no effect on that. Setting the value as you did using the OSC{} syntax is overkill, you only need to set the widget's address to /fxparam/1/name (or /fxparam/@{parent.variables.n}/name if it resolves properly).

If your app sends to port 9010 then yes you do need to set port (or at least osc-port) to 9010 in the launcher.

Hi, thanks for the hint with the address - makes it easier.
So it's not possible to set different osc send/receive ports for some text and rotary widgets in the same OSC template next to the default ports set in the Launcher ? Thanks, mj

You can send to any number of targets using the target property or with scripting, but there's only one receiving port for osc messages (at least when using the udp protocol but that's a different story which I think is irrelevant here) .

1 Like

Ok, now I see - thanks for clearing up. Regards, mj

Sorry to broach the subject again.... would it be possible to include more than one osc receiving port as it is possible for midi ports ? Or are there technical limitations ?

I don't see any good reason to do so, why do you need that ?

Really? It's possible to set a widget to receive from multiple MIDI ports?
(sorry about the offtopic question)

Hi, I would like to use 2 different OSC api's of Reaper. The ReaperControl template is based on the inbuilt osc api. And for one part of the template (fx parameters) I would like to use the Reaper CSI extension so I don't have to rewrite the whole OSC template or write a complete CSI setup... (lazy, I know :wink: )

But as you mention MIDI .... maybe I could use that in parallel for fx parameter data ?

Then you can make these 2 different api send to the same port that osc uses, there's nothing wrong with that.

For example you could set a widget's target to

['midi:a', 'midi:b']
1 Like

So, I tried that approach and yes, I can receive messages from two different api's to the same port. But now I get the same messages in different order (ordering the messages is the reason to use the second api) at the same time - not good.
Is there a way to solve that with a custom module ? Is it possible by switching a button in osc to let some widget's send AND receive from different ip ports (defined in the custom module) rather the ports defined in the launcher ? Regards, mj

But now I get the same messages in different order (ordering the messages is the reason to use the second api) at the same time

So the problem is that both API send the same message, isn't it ?

There's no need to add another receiving port, you can determine which API sent the message to OSC in the custom module using data.port.

Hmmm... I don't get it. How can OSC distinguish between 2 receive ports in the custom module if only 1 can be used (the one in the launcher, I guess) ?
Just to clarify: I'm talking about ip ports not midi ports.

Can I define the 2 ports in the custom module ?

Regards, mj

No you can't define two receiving port - well it's technically possible but it doesn't make sense because - your two API's should be sending from two different ports and that's how you can distinguish them:

module.exports = {
  oscInFilter: function(data){
    console.log(data.port) // this is the port from which the message was sent 
    return data

Thank you. I think I understand now. I would have to look into the marked port numbers ?

Sadly, Reaper seems to change this port numbers with every restart...

Are you sure ? I see two messages from 53424, if the two ports are set randomly at start but don't change during the session you should be able to sort it out. If the ports change all the time then you might want to ask the developers to use a fixed sending port, the usual way for a software is to use the same port for receiving and sending messages.

Yes, that's correct - it seems they stay the same during a session.