/
/
/
1"""Constants for the Sendspin Source provider."""
2
3from __future__ import annotations
4
5CONF_TARGET_LATENCY = "target_latency"
6DEFAULT_TARGET_LATENCY_MS = 500
7
8# Fixed PCM output format for all Sendspin sources. The source's native format is
9# only known once the client starts streaming, so the stream declares this format
10# upfront and the bridge converts to it.
11OUTPUT_SAMPLE_RATE = 48000
12OUTPUT_BIT_DEPTH = 16
13OUTPUT_CHANNELS = 2
14
15CHUNK_DURATION_MS = 25
16
17# Give up and end the stream after this long without source audio (client never
18# started, disconnected, or reports unavailable).
19SOURCE_TIMEOUT_S = 30.0
20
21# Fail the stream if the client sends nothing at all after being asked to start.
22# A source that never arrives is a failed acquisition, not a silent line-in.
23COLD_START_TIMEOUT_S = 5.0
24
25# Hold a new line-in signal this long before starting. A preamp hovering around its
26# detection threshold reports present/absent repeatedly.
27AUTOSTART_SIGNAL_DEBOUNCE_S = 2.0
28
29# Keep playing this long after the signal disappears, so the gap between tracks or a
30# quiet passage does not end the stream.
31AUTOSTART_SIGNAL_ABSENT_HOLD_S = 60.0
32