2023-11-02 05:22:31 +01:00
|
|
|
extends Control
|
|
|
|
|
|
|
|
|
|
|
|
func _ready():
|
|
|
|
var scene = preload("res://osc_receiver.tscn")
|
|
|
|
var osc_server = scene.instantiate()
|
|
|
|
add_child(osc_server)
|
|
|
|
|
|
|
|
# configure all sensors
|
|
|
|
for i in range(4):
|
|
|
|
var nodename = "VSlider%d" % (i + 1)
|
|
|
|
var osc_addr = "/slider/%d/set" % i
|
|
|
|
var slider_node = find_child(nodename)
|
|
|
|
osc_server.register_callback(osc_addr, "f", slider_node.recv_osc)
|
|
|
|
|
|
|
|
for i in range(4):
|
|
|
|
var nodename = "Button%d" % (i + 1)
|
|
|
|
var osc_addr = "/button/%d/set" % i
|
|
|
|
var button_node = find_child(nodename)
|
|
|
|
osc_server.register_callback(osc_addr, "i", button_node.recv_osc)
|
|
|
|
|
2023-11-04 11:49:08 +01:00
|
|
|
osc_server.register_callback("/string", "s", recv_osc)
|
|
|
|
osc_server.register_callback("/stringint", "si", recv_osc)
|
|
|
|
osc_server.register_callback("/blob", "b", recv_osc)
|
|
|
|
osc_server.register_callback("/blobint", "bi", recv_osc)
|
|
|
|
|
2023-11-02 05:22:31 +01:00
|
|
|
# start listening for osc messages
|
|
|
|
osc_server.start_server()
|
2023-11-04 11:49:08 +01:00
|
|
|
|
|
|
|
func recv_osc(msg_info, values):
|
|
|
|
print("Sender IP: %s" % msg_info["ip"])
|
|
|
|
print("Sender Port: %d" % msg_info["port"])
|
|
|
|
print("Address: %s" % msg_info["address"])
|
|
|
|
print("Types: %s" % msg_info["types"])
|
|
|
|
print("Values:", values)
|