ch output: per-channel output routing dropdowns

- Added GET/POST /api/channel-output endpoints for per-channel
  output routing (playback_1 / playback_2 / both)
- Added output dropdowns to CH 1 and CH 2 cards in Audio Interface
- Added setChOutput() and loadChOutput() JS functions
- Updated connect_fx_ports to read per-channel output config
This commit is contained in:
2026-06-16 19:18:30 -04:00
parent e324d9007b
commit 334e035cde
2 changed files with 64 additions and 3 deletions
+33
View File
@@ -997,6 +997,39 @@ class WebServer:
})
return {"ok": True, "channel_mode": mode}
# ── Per-channel output routing ────────────────────────────
@app.get("/api/channel-output")
async def get_channel_output():
"""Get output routing for each channel."""
audio = self.deps.audio_system
if not audio or not audio.config:
return {"ch1": "both", "ch2": "both"}
cfg = audio.config.__dict__ if hasattr(audio.config, '__dict__') else {}
return {
"ch1": cfg.get("ch1_output", "both"),
"ch2": cfg.get("ch2_output", "both"),
}
@app.post("/api/channel-output")
async def set_channel_output(data: dict):
"""Set output routing for a channel.
Body: { "ch": 1, "port": "playback_1"|"playback_2"|"both" }
"""
ch = int(data.get("ch", 1))
port = data.get("port", "both")
if port not in ("playback_1", "playback_2", "both"):
raise HTTPException(status_code=400, detail=f"Invalid port: {port}")
audio = self.deps.audio_system
if audio and audio.config:
key = f"ch{ch}_output"
if hasattr(audio.config, 'input_device'):
setattr(audio.config, key, port)
# Reconnect JACK ports
audio.connect_fx_ports()
return {"ok": True, f"ch{ch}": port}
@app.get("/api/models")
async def list_models(channel: str = "guitar"):
"""List available NAM models for the given channel."""