Initial tablet POC: project restructure + WebSocket/HTTP server + JS client
- Restructured project into /app, /server, /client with run.py entry point - WSServer (QWebSocketServer) with log_signal, start/stop, client tracking - HTTP server serves /client on port 8080 - Vanilla JS client: faders, toggles, transport, drag-to-arrange, lock/save layout - Start Tablet button + floating Tablet log window in app UI - Preset broadcast on load/switch, DAW state relay, hardware sync via widget_update - Widget colors synced from app palette, toggle state fixed (sends 0/127 correctly) - Layout saved per preset UUID back to presets.json Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
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}")
|
||||
Reference in New Issue
Block a user