diff --git a/lightsync/main.py b/lightsync/main.py index 6f1ed8b..b3e7d9d 100644 --- a/lightsync/main.py +++ b/lightsync/main.py @@ -7,6 +7,7 @@ from fastapi.staticfiles import StaticFiles from lightsync.devices.registry import DeviceRegistry from lightsync.store.show_store import ShowStore +from lightsync.protocol.udp_sender import UDPSender # Module-level containers populated in lifespan registry: DeviceRegistry | None = None @@ -25,9 +26,15 @@ async def lifespan(app: FastAPI): # Beat analysis cache: filepath -> {"tempo": float, "beats": [float, ...]} app.state.beats = {} + # UDP sender for device communication (Phase 3) + udp_sender = UDPSender() + await udp_sender.start() + app.state.udp_sender = udp_sender + yield # Shutdown + await app.state.udp_sender.stop() await registry.save()