Files
virtual-controller/app-desktop-macos/osc_sender.py
T
Paul Lipscomb 6f66a5db64 Move feedback stutter bug report to android folder
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-30 19:14:00 -05:00

37 lines
832 B
Python

from pythonosc import udp_client
from osc_receiver import osc_receiver
_osc_client = None
_osc_send_port = 8000
_osc_send_ip = "127.0.0.1"
def get_osc_client():
global _osc_client
if _osc_client is None:
_osc_client = udp_client.SimpleUDPClient(_osc_send_ip, _osc_send_port)
return _osc_client
def set_osc_target(ip=None, port=None):
global _osc_client, _osc_send_ip, _osc_send_port
if ip is not None:
_osc_send_ip = ip
if port is not None:
_osc_send_port = port
_osc_client = None
def send_osc_message(address, value=1.0):
try:
get_osc_client().send_message(address, float(value))
osc_receiver.osc_out_signal.emit(address, str(value))
print(f"[OSC] -> {address} {value}")
except Exception as e:
print(f"[OSC send] Error: {e}")