Skip to content

Report a line-in signal to the server with --signal-threshold - #138

Open
meiser79 wants to merge 3 commits into
Sendspin:mainfrom
meiser79:feature/signal-threshold
Open

meiser79 wants to merge 3 commits into
Sendspin:mainfrom
meiser79:feature/signal-threshold

Conversation

@meiser79

Copy link
Copy Markdown

Sendspin/spec#335 requires every source to report signal in its client/state source object and removes the client's source@v1_support object from client/hello. This lets the input tell the server when it carries a signal, so a server can start and stop it on its own, for example a turntable when the needle drops.

  • --signal-threshold <dBFS> (-90 to -1) sets signal from the input's RMS level: present after 500 ms above the level, absent after 5 s below it. Without the option the input reports absent, so a server only plays it when asked to.
  • With the option the capture device stays open while idle, since the level can only be read from audio the card delivers. Audio reaches the source role only while the server streams it.
  • sendspin-cli status shows the state on the input: line.
  • Options::given_ is widened to 64 bits: --signal-threshold is the 33rd option, so its bit wrapped onto -o's, and a config file that set output made signal-threshold look given.
  • README and the Advanced Usage wiki page describe the option.

Depends on Sendspin/sendspin-cpp#287

The library still sends source@v1_support and only reports signal with SourceRoleConfig::line_sense. Until Sendspin/sendspin-cpp#287 is in a release, this branch builds against that PR's commit on a fork (SENDSPIN_GIT_REPOSITORY/SENDSPIN_GIT_TAG in CMakeLists.txt). That pin should move back to a sendspin-cpp release before this is merged.

Tests

signal_detector_test.cpp covers the attack and release timing and the threshold; the option, config file, status and audio source tests cover the rest. 712 of 714 tests pass locally. The two failures, ARelativeControlSocketIsMadeAbsoluteUnderZ and AConfiguredControlSocketIsAbsolutizedUnderDaemonize, came from my long build path: the control socket path in the build directory exceeded the 107-byte Unix socket limit.

🤖 Generated with Claude Code

meiser79 and others added 3 commits November 26, 2026 17:42
Every source state carries the spec's `signal` (Sendspin/spec#335): with
--signal-threshold <dBFS> it is present or absent from the input's RMS
level, so a server can start and stop the input on its own; without it
the input reports absent, so a server never starts it unasked. Present
after 500 ms above the level, absent after 5 s below it. The capture
device stays open while idle so the level can be read; audio reaches the
role only while the server streams it. status shows the state on the
input line.

Builds against a sendspin-cpp fork commit that always reports the signal
until that is released.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Options::given_ was a uint32_t and --signal-threshold is the 33rd
option, so its bit wrapped onto -o's: a config file that set output made
signal-threshold look given and skipped it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Pin the fork commit of Sendspin/sendspin-cpp#287, which only drops the
client's source@v1_support and always reports the source signal
(Sendspin/spec#335), instead of a commit that also carries
SourceRole::set_metadata(), which this branch does not use.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant