This MA2 plugin lets you send OSC commands.
SendOSC supports both using the plugin in Macros or running in your own LUA script. It also handles MA variables.
SendOSC currently supports the following data types:
To send OSC commands from your macros you can use the following syntax:
Plugin SendOSC "host_port, /OSC_address, values"
For example:
Plugin SendOSC "127.0.0.1:8000, /this_is_a_float, 5.6"
Plugin SendOSC "127.0.0.1:8000, /this_is_an_integer, 56"
Plugin SendOSC "127.0.0.1:8000, /this_is_a_string,Hello World!"
Plugin SendOSC "127.0.0.1:8000, /this_is_a_bool, true"
You can provide type by using the equal sign in the format of t=value where t is one of i, f, s, T, F, N, I.
Plugin SendOSC "127.0.0.1:8000, /this_is_a_float, f=1"
Note that value is omitted in case of types T, F, N, I.
Plugin SendOSC "127.0.0.1:8000, /this_is_an_integer, i=1.0"
Plugin SendOSC "127.0.0.1:8000, /this_is_an_integer, T=999"
You can pass multiple values using comma:
Plugin SendOSC "127.0.0.1:8000, /multiple/float/true/string, f=1, true, Hello World!"
Plugin SendOSC "127.0.0.1:8000, /multiple/floats, 0.85, 0.65, 0.0"
You can use SendOSC in your own script.
If you have SendOSC Plugin in your Plugin Pool it will define a SendOSC function which can be called just as the plugin itself.
SendOSC LUA Function accepts either one or three parameters. If you provide one parameter, you can refer to the command line syntax. If you provide three parameters, they would be:
SendOSC(host_port, osc_address, data)
where data can be any of the following, or an array of the following: number, boolean, nil, string, or a table containing type definition in the format of {t=value} where t is one of i, f, s, T, F, N, I.
String can be parsed just as if you used one parameter:
SendOSC('127.0.0.1:8000', '/this_is_a_string', 'Hello World!')
SendOSC('127.0.0.1:8000', '/this_is_an integer', '1')
SendOSC('127.0.0.1:8000', '/this_is_a_float', '1.0')
SendOSC('127.0.0.1:8000', '/multiple_params', '1,1.0,f=1.0,etc.')
Passed numbers' type interpretation depends on if it is whole or not:
SendOSC('127.0.0.1:8000', '/this_is_an_integer', 1.0)
SendOSC('127.0.0.1:8000', '/this_is_a_float', 0.9)
These are all nulls:
SendOSC('127.0.0.1:8000', '/this_is_null', nil)
SendOSC('127.0.0.1:8000', '/this_is_null', 'nil')
SendOSC('127.0.0.1:8000', '/this_is_null', 'Null')
These are all booleans:
SendOSC('127.0.0.1:8000', '/this_is_true', true)
SendOSC('127.0.0.1:8000', '/this_is_true', 'TRUE')
SendOSC('127.0.0.1:8000', '/this_is_false', 'false')
You can specify types by passing a table in {t=value} format, where t represents the type:
SendOSC('127.0.0.1:8000', '/this_is_a_string', {s=1.0})
Note that value is omitted in case of types T, F, N, I.
SendOSC('127.0.0.1:8000', '/this_is_an_integer', {i='1.0'})
SendOSC('127.0.0.1:8000', '/this_is_a_boolean', {T='1.0'})
You can specify multiple values by passing them in an array:
SendOSC('127.0.0.1:8000', '/multiple', {true, 1, '1.0', {f=1}, {s='Hello, '}, 'World!'})
If you do not explicitly provide type for a given value, the plugin will try to guess the type.
Rules for this are:
If any of the strings passed contains a dollar sign followed by an alphanumerical string, it will be substitued with the corresponding MA2 variable.
For example, you can use this to store destination IP and PORT in a variable and use the variable in your macros.
Use variable in your showfile as a destination IP/PORT setting:
LUA "SendOSC('$MEDIASERVER', '/this_is_a_float', {f=1})"
Plugin SendOSC "$MEDIASERVER, /this_is_a_float, f=1"
Plugin SendOSC "$MEDIASERVERIP:8123, /this_is_a_float, f=1"
Plugin SendOSC "$MEDIASERVERIP:$MEDIASERVERPORT, /this_is_a_float, f=1"
Use variable in your showfile as an element in the OSC address:
LUA "SendOSC('$MEDIASERVER', '/composition/$MEDIAID/connect', 1)"
Use variable in your showfile as a value:
LUA "SendOSC('127.0.0.1:8000', '/selected_fixtures_count', {i='$SELECTEDFIXTURESCOUNT'})"
Plugin SendOSC "127.0.0.1:8000, /selected_exec_cue, $SELECTEDEXECCUE"