Skip to content

Add an RMS line-sense option to the source client example - #201

Merged
kahrendt merged 2 commits into
mainfrom
source-line-sense-example
Oct 12, 2026
Merged

kahrendt merged 2 commits into
mainfrom
source-line-sense-example

Conversation

@kahrendt

Copy link
Copy Markdown
Contributor

Addresses #133.

The spec has the server alone start a source stream (roles/source/v1.md "Default streaming behavior"); a client reports line sense as a hint. The library already supports that through SourceRoleConfig::line_sense and SourceRole::set_signal(), and detection stays in the application.

  • docs/integration-guide.md: says detection is the application's job and to call set_signal() on each change.
  • examples/source_client: -s DBFS meters each buffer's RMS level and reports present after 100 ms at or above the threshold, absent after 2 s below. Capture runs from startup in that mode; audio reaches write_audio() only while the stream is open. Without -s the example is unchanged.

Testing: built and run on macOS; -s -70 on the laptop mic reported absent then present, and an invalid threshold is rejected. No unit tests (example code).

Signal detection belongs to the application; the integration guide now says so, and source_client's -s DBFS reports line sense from the input's RMS level (100 ms to turn present, 2 s to turn absent).
@kahrendt
kahrendt marked this pull request as ready for review October 12, 2026 16:39
@kahrendt
kahrendt requested a balanced review from Copilot October 12, 2026 16:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The untested metering state machine and inaccurate timing documentation should be addressed before approval.

5 open findings
What changed in this PR

Adds optional RMS-based line sensing to the source client example.

Changes:

  • Adds -s DBFS with 100 ms present and 2 s absent holds.
  • Keeps capture active for metering while gating audio forwarding.
  • Documents application-managed line sensing.
File Description
examples/​source_client/​README.md Documents line-sense usage.
examples/​source_client/​main.cpp Implements RMS metering, holds, and signal reporting.
docs/​integration-guide.md Clarifies line-sense responsibilities.

🧠 Review effort: Balanced


💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread examples/source_client/main.cpp
Comment thread examples/source_client/README.md Outdated
Comment thread examples/source_client/main.cpp
Comment thread examples/source_client/main.cpp Outdated
Comment thread examples/source_client/main.cpp
@kahrendt
kahrendt merged commit 81216ba into main Oct 12, 2026
16 checks passed
@kahrendt
kahrendt deleted the source-line-sense-example branch October 12, 2026 16:52
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.

2 participants