OSC TCP

Navigation:  Widget Designer > Devices > OSC >

OSC TCP

prev main next

Navigation:  Widget Designer > Devices > OSC >

OSC TCP

prev main next

Loading...

The OSC TCP device in the Configuration dialog allows to set up a connection to another OSC device with an enabled TCP server. The IP and port are scriptable, allowing the OSC TCP device to connect to various devices on the fly. Incoming messages, e.g. feedback or status information can be received via Event Listeners or the OSC TCP input node. Messages can be sent using Widget Designer's scripting or OSC TCP output node. Using the OSC Table is optional.

Note that the device is only available in the licensed Widget Designer edition, not the Free version.

Adding a New OSC TCP Device

To add an OSC TCP device, open the Devices menu and select "OSC > TCP > Create TCP". This will open the Configuration dialog. Alternatively, you can add a new OSC TCP device in the Configuration dialog with the "+" button when the dialog is already open.

In the dialog, the left side lists all devices and connections that were already added to the project. The circle in front of the entry symbolizes the current connection status:

wd_config_status_filled-blue

The OSC TCP device is enabled and connected.

wd_config_status_empty-blue

The OSC TCP device is enabled but not connected; check the IP address and port settings and the general network connection.

wd_config_status_filled-gray

The connection or device is disabled, i.e. the "Enable" box is not checked.

On the right side you see several options:

WD_OSC-TCP

The Type informs you about the type of device or connection.

The Groups lists the groups to which this device belongs.

The Name is the unique identifier for this object in WD and the general rules for naming objects apply here as well: only letters, numbers and underscores are allowed; the first symbol must be a letter.
It is possible to change the default name to a more descriptive one. When scripting, enter this Name to access available members or use the Project object and device Type instead; examples are shown further down.

The Id offers an alternative way to address the device when scripting.

The "Enable" check box is selected by default and can be used to disable the device or connection internally.

Now, please enter the IP Address and Port of the remote OSC TCP server.

The option "Send each message as bundle" toggles whether outgoing values are sent as OSC (single) messages or OSC bundles. Some OSC devices can only receive bundles.

Click the "Apply" button to save any changes done here. The shortcut [Ctrl + Enter] can also be used to apply changes. Once the settings are applied, the dialog can be closed. The newly created connection will also be added to the Devices menu > OSC > TCP and can be opened from here or with the Devices menu > Configuration.

Using the Device in Regular Scripting

As soon as a device is created, it can be addressed via scripting.

To send messages to the connected OSC TCP server, for example, create a CustomScript button or use anything with a scripting field. Enter the device's identifier name into the script field (per default that is "OSC_TCP1") and Script Assist will offer a list of all OSC TCP Members.

To send a message, you have two choices. The first is using the member "Send" which refers to an "OSC Table" where you can define the OSC address and parameter types and refer to them as aliases; see description "Send").
The second scripting possibility allows to define all this information in one step. Again, there is a verbose description for the member "SendRaw". In short, the following example uses the OSC address "/1/fader1", defines the following parameters as a string (=s) and integer (=i) and sends the values wrapped in a list: "Hi" and 10.
 
OSC_TCP1.SendRaw("/1/fader1","si",["Hi",10])

Literal text should always be enclosed in either single or double quotation marks; otherwise, the text is handled like a variable. The next example sends only one value (still in the list format) and shows how to convert the global variable "Now", which holds the current date and time, to a string.

OSC_TCP1.SendRaw("/1/fader1","s",[Now.ToString])

As an alternative to explicitly naming the connection, the "Project" object can be used. Choose the connection type and address the connection by entering its ID or name. Script Assist then offers you the same list of members. This is the alternative for the first example from above:
Project.OSC_TCP(1).SendRaw("/1/fader1","si",["Hi,10"]

Substituting the ID with a dynamic variable allows automation. Actions can be performed on many connections of the same type simultaneously, e.g. by using for-loops:
For i = 1 to 10 {

 Project.OSC_TCP(i).SendRaw("/1/fader1","si",["Hi,10"])

}

The chapter "Project and Context Member" shows more examples with for-loops and if-clauses; of course, normal variables can also be used.

Using the Connection with Event Listener and Group Event Listener

Event Listeners can be added in the Configuration dialog and provide the easiest way to handle incoming messages.

Please see the chapter Event Listener and Group Event Listener for a detailed description of its functionality and OSC TCP Events for an overview (with examples and description) of the available events.

Using the Device in the Node System

The OSC TCP input node refers to this device connection when the according ID is entered. It shows incoming messages. In the same way, the OSC TCP output node refers to this connection and sends messages. In difference to the input node, the OSC Code Table is not only optional but essential.
Please see the chapter "Tutorial: Nodes" for information about the node system.