Files
raspberry-pi-mixer/main_touch.py
T
shawn 9cd8292acc
Lint & Validate / lint (push) Has been cancelled
Phase 1-4: Audio stack, mixer engine, MIDI, and network API
P2-R1: ALSA + JACK2 low-latency config (scripts, quirks, tuning)
P2-R2: Carla integration (build scripts, 8ch rack config, NAM LV2 support)
P2-R3: Plugin manager, categories, blacklist, NAM model support
P3-R1: Mixer DSP engine (channel strip, routing matrix, bus mgr, automation)
P4-R1: MIDI engine (learn mode, clock sync, HID discovery, mapping store)
P4-R2: Network API (OSC server, FastAPI REST, WebSocket, auth, rate limiter)
P5-R1: Touchscreen UI evaluation + main entry point
docs: Audio stack, Carla integration, MIDI support, UI evaluation
tests: Full test suite (292 passing)
2026-05-19 20:39:17 -04:00

86 lines
2.5 KiB
Python

#!/usr/bin/env python3
"""Entry point for the Raspberry Pi Touchscreen Mixer UI.
A Kivy-based multi-touch mixer control surface for the
Raspberry Pi RT Audio Mixer. Connects to the mixer engine
via REST API + OSC.
Usage:
python3 main_touch.py
python3 main_touch.py --host 192.168.1.10 --port 8000
python3 main_touch.py --api-key my-secret-key
KIVY_DPI=220 python3 main_touch.py
"""
from __future__ import annotations
import argparse
import os
import sys
def main():
parser = argparse.ArgumentParser(
description="Raspberry Pi Touchscreen Mixer UI",
formatter_class=argparse.RawDescriptionHelpFormatter,
epilog="""
Examples:
%(prog)s # local mixer on :8000
%(prog)s --host 192.168.1.10 # remote mixer
%(prog)s --host 127.0.0.1 --api-key abc123 # with auth
KIVY_DPI=220 %(prog)s # force 220 DPI
Environment:
MIXER_HOST mixer hostname (default 127.0.0.1)
MIXER_PORT REST API port (default 8000)
MIXER_OSC_PORT OSC server port (default 9001)
MIXER_API_KEY API key for authentication
KIVY_DPI force screen DPI (auto-detected otherwise)
""",
)
parser.add_argument(
"--host", default=os.environ.get("MIXER_HOST", "127.0.0.1"),
help="Mixer server hostname (default: 127.0.0.1)",
)
parser.add_argument(
"--port", type=int, default=int(os.environ.get("MIXER_PORT", "8000")),
help="REST API port (default: 8000)",
)
parser.add_argument(
"--osc-port", type=int, default=int(os.environ.get("MIXER_OSC_PORT", "9001")),
help="OSC server port (default: 9001)",
)
parser.add_argument(
"--api-key", default=os.environ.get("MIXER_API_KEY", ""),
help="API key for mixer authentication",
)
args = parser.parse_args()
# Ensure src is on the path
project_root = os.path.dirname(os.path.abspath(__file__))
if project_root not in sys.path:
sys.path.insert(0, project_root)
# Import Kivy app (late import after CLI parsing)
from src.ui.app import MixerApp
app = MixerApp(
host=args.host,
rest_port=args.port,
osc_port=args.osc_port,
api_key=args.api_key,
)
print(f"Starting touchscreen mixer UI...")
print(f" Mixer server: {args.host}:{args.port}")
print(f" OSC server: {args.host}:{args.osc_port}")
print(f" Touch to begin. ESC to cycle screens.")
print()
app.run()
if __name__ == "__main__":
main()