OSC and GP Script

I’m testing a Multi Instance setup using OSC to exchange commands between the 2 instances. Basic setup is working, eg using OSC to sync an On/Off switch between the 2 instances.

I tried to use the “OSC_SendString” command from within a GP script to send a string to a text-label. But nothing happened. Compile is ok and also no error msg. I used this following command (based on the GP function list):

              OSC_SendString ("/OnOffText/SetValue", "ON")

OnOffText is the OSC Name of the text widget.

Is it possible to use OSC_SendString to send a msg to a OSC enabled widget within gig performer ? Or what is the use case for the OSC_SendString command?

You have to use OSC sending specific messages.
There are messages where you can give the up address and port.

The value of a text label is not what you want.

oscHandle/SetCaption

Specific Send command (with related loopback / port) with SetCaption

   OSC_SendStringSpecific("/OnOffText/SetCaption", "ON", "127.0.0.1", 54341)

is working.

THANKS for the hint

GP shows " /OnOffText/SetValue " within the widget set-up and not the required “/OnOffText/SetCaption”.

1 Like

I would also recommend you don’t reference specific port numbers in the scripts. If you set up an OSC Target for your second instance in the OSC Options window, you can then reference its port number using functions like this:

OSC_GetPortNumberFromTargetName : Returns the port number or -1 if target does not exist

It means you will never have to update the scripts if you ever need to change the port number.

1 Like

So far i have only looked / searched for the OSC function i need :grin: … but you are right and that’s a good point … thanks

Based on the very useful input i have now also a solution to sync a widget value from one instance to another. Eg: the status of a Leslie Speed Switch (as displayed in the widget caption) will be synced from the Organ instance to the Main instance:

var

// Declaration of Widgets - Select and Show Presets

// IP and Port for Main and Secondary GP Instance … OSC_GetPortNumberFromTargetName

MainIP : String = “127.0.0.1”
MainPort : Integer = 54341
OrganIP : String = “127.0.0.1”
OrganPort : Integer = 54342

ShowValue : String

B3XLeslieSpeed : Widget
B3XLeslieCab : Widget

B3X_Cab_Type : String Array = [“122”, “122 A”, “147”, “3300 W”, “Studio 12”]
B3XLeslieAmp : Widget

On WidgetValueChanged (w: Widget, index: integer, Cab_Val : double) from B3XLeslieSpeed

Select
Cab_Val > 0.5 do ShowValue = “Slow”
Cab_Val >= 0.0 do ShowValue = “Fast”
End

OSC_SendStringSpecific(“/B3XLeslieSpeed/SetCaption”, ShowValue, MainIP, MainPort)
OSC_SendStringSpecific(“/B3XLeslieSpeed/SetCaption”, ShowValue, OrganIP, OrganPort)

End

On WidgetValueChanged (w: Widget, index: integer, Cab_Val : double) from B3XLeslieCab

ShowValue = MapValueToDiscreteString(Cab_Val, B3X_Cab_Type)

OSC_SendStringSpecific(“/B3XLeslieCab/SetCaption”, ShowValue, MainIP, MainPort)
OSC_SendStringSpecific(“/B3XLeslieCab/SetCaption”, ShowValue, OrganIP, OrganPort)

End

It also works with multi value switches as shown for the cabinet selection.

I also tried a shorter version using

 OSC_SendStringSpecific("/B3XGAmpSelect/SetCaption", GetWidgetLabel (w), MainIP, MainPort))   

but this was not working due to (timing ??) Problem - the command always sync the old/former value