feat: decide the classroom's audio output from what is plugged in

The room that prompted this had a television on HDMI with working PCM
audio and nothing in the analog jack, and WirePlumber chose analog. A
teacher who corrected it by hand then had to restart the browser before
any sound came out.

The policy is a pure function so it can be tested against that room
rather than against a machine: an unavailable port is not a candidate,
an analog port merely existing is not evidence of a cable, and an
explicit AUDIO_OUTPUT overrides the lot. Twelve cases, the real room
among them.

The daemon follows PipeWire's own event stream rather than polling, and
moves streams that are already playing, which is the part that stops a
teacher having to close and reopen the browser.

Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
ekklesia
2026-09-10 08:47:28 -05:00
co-authored by Claude Opus 5
parent 87b55761c6
commit 2ff9d47be9
27 changed files with 626 additions and 40 deletions
+27
View File
@@ -31,6 +31,18 @@ DVD_ENABLED=false
# implemented yet; this only controls whether the current placeholder appears.
LIVE_ENABLED=false
# Which output the room plays through.
#
# auto prefer a connected HDMI or DisplayPort television, and fall
# back to the analog jack. This is right for almost every room.
# hdmi always the television, even if it does not report itself.
# analog always the jack.
#
# auto re-decides whenever the hardware changes, so a television switched
# on after the computer is picked up without anybody touching anything,
# and sound that is already playing is moved across to it.
AUDIO_OUTPUT=auto
# Size of the dock, clock and notifications, 0.8 to 1.5.
# Larger rooms and larger TVs want a larger number.
UI_SCALE=1.0
@@ -60,6 +72,21 @@ DVD_ENABLED=false
"""# Show the Sanctuary LIVE placeholder in the dock. Live viewing is not
# implemented yet; this only controls whether the current placeholder appears.
LIVE_ENABLED=false
""",
),
(
"AUDIO_OUTPUT",
"""# Which output the room plays through.
#
# auto prefer a connected HDMI or DisplayPort television, and fall
# back to the analog jack. This is right for almost every room.
# hdmi always the television, even if it does not report itself.
# analog always the jack.
#
# auto re-decides whenever the hardware changes, so a television switched
# on after the computer is picked up without anybody touching anything,
# and sound that is already playing is moved across to it.
AUDIO_OUTPUT=auto
""",
),
(