Skip to content

os-session: live speaker safety guard on device output - #463

Merged
ItsAlphaNeon merged 1 commit into
mainfrom
live-listening-guard
Dec 1, 2026
Merged

ItsAlphaNeon merged 1 commit into
mainfrom
live-listening-guard

Conversation

@thacer13

Copy link
Copy Markdown
Collaborator

Adds a zero-allocation, lock-free live speaker safety guard (ListeningGuard) in os-session::device::Mix::block:

  • Live output only: runs strictly on the audio device output mix (Linux, macOS, Windows WASAPI, ASIO) — never touches offline renders or exports.
  • Bit-exact passthrough for normal audio: normal mixes pass through completely untouched (gain == 1.0).
  • Fault protection: scrubs NaN/Inf samples to silence and trips a -24 dB attenuation floor (0.0625) whenever runaway output exceeds +12 dBFS (|sample| > 4.0), hard-clamping finite blowups before scaling so extreme spikes (1e6, 1e30) stay safely bounded.
  • Smooth auto-recovery & telemetry: holds the safe floor while loud/faulty samples persist, smoothly recovers back to 1.0 once safe, and tracks trip count atomically via device::guard_trips() for future UI indicators.

Verification

  • cargo test --locked -p os-session listening_guard — passed (verifies bit-exact passthrough, NaN/Inf scrubbing, runaway finite clamping, atomic trip counter, and automatic recovery).
  • cargo clippy --locked -p os-session --no-deps — zero warnings in device.rs.

@ItsAlphaNeon
ItsAlphaNeon merged commit a17fb99 into main Dec 1, 2026
3 checks passed
@ItsAlphaNeon
ItsAlphaNeon deleted the live-listening-guard branch December 1, 2026 13:36
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