Skip to content

fix(lib): expose the microphone noise filter in the C++ and C APIs - #602

Closed
ChrisLauinger77 wants to merge 2 commits into
Sapd:masterfrom
ChrisLauinger77:feat/lib-noise-filter
Closed

ChrisLauinger77 wants to merge 2 commits into
Sapd:masterfrom
ChrisLauinger77:feat/lib-noise-filter

Conversation

@ChrisLauinger77

@ChrisLauinger77 ChrisLauinger77 commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Changes made

CAP_NOISE_FILTER has a device method and a CLI handler, but no library entry point, so applications linking libheadsetcontrol can detect the capability but not set it.

  • Add Headset::setNoiseFilter() and hsc_set_noise_filter().
  • Cover both through the test device in tests/test_library_api.cpp, including the null-handle check.
  • Add C++ and C examples to docs/LIBRARY_USAGE.md.
  • The setter checks the level against the capability descriptor (0-2) before dispatching, as the 0-128 setters do, so hsc_set_noise_filter(handle, 3) returns HSC_RESULT_INVALID_PARAM on every device, including the test device, which accepts any level.
  • docs/ADDING_A_CAPABILITY.md never mentioned the library APIs, which is how this one was missed, so it gains a step 9 for them.

No API_VERSION bump: the structured output is unchanged.

Checklist

  • I adjusted the README (if needed)
  • For new features in HeadsetControl: I discussed it beforehand in Issues or Discussions and adhered to the wiki Not applicable: this is a fix and adds no new capability.

CAP_NOISE_FILTER has had a device method and a CLI handler since it was
added, but no library entry point, so applications linking
libheadsetcontrol could detect the capability and not set it.

Add Headset::setNoiseFilter() and hsc_set_noise_filter(), cover both
through the test device, and document them in LIBRARY_USAGE.md. Level
validation stays in the devices, which already reject anything above 2.

The capability guide never mentioned the library APIs, which is how this
one was missed, so it gains a step for them.
@github-actions github-actions Bot added the awaiting-maintainer The author replied or pushed - our move label Oct 22, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-22T15:48:23.849390Z d08f21f Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 387198d2b8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lib/headsetcontrol.cpp Resolved
The 0-2 range is the public contract of setNoiseFilter() and
hsc_set_noise_filter(), but the setter only relied on the devices to
reject anything above it. The real implementations do; the test device
echoes any level, so hsc_set_noise_filter(handle, 3) returned
HSC_RESULT_OK there.

Check the level against the capability descriptor before dispatching, as
the 0-128 setters already do, cover the rejected value in both API tests,
and mention it in the capability guide's validation section.
@ChrisLauinger77

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: d08f21f765

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sapd added a commit that referenced this pull request Oct 22, 2026
)

CAP_NOISE_FILTER had a device method and a CLI handler but no library entry
point, so applications linking libheadsetcontrol could detect the capability
without being able to set it. Add Headset::setNoiseFilter() and
hsc_set_noise_filter(), bounded 0-2 in the library since all three device
implementations reject anything higher, and document the library step in
ADDING_A_CAPABILITY.md.
@Sapd

Sapd commented Oct 22, 2026

Copy link
Copy Markdown
Owner

Merged as 8b255b0. Had to squash it locally rather than through the button: 0c875d2 rewrote the same Validation paragraph, so the two collided in ADDING_A_CAPABILITY.md. Kept both sides — the three-bound ordering plus your note that a range every device shares is bounded in the library too.

Side effect of merging it by hand is that the commit is authored by me instead of you. Not intentional and I can't rewrite it, master rejects force pushes. The work is yours.

@Sapd Sapd closed this Oct 22, 2026
@github-actions github-actions Bot removed the awaiting-maintainer The author replied or pushed - our move label Oct 22, 2026
@ChrisLauinger77
ChrisLauinger77 deleted the feat/lib-noise-filter branch October 22, 2026 19:39
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