feat(audio): live mic meter with draggable noise gate
Adds a mic input meter to Settings for gate calibration, replacing the blind noise-gate slider with a unified Discord/OBS-style control: the bar shows the live mic level and a draggable handle sets the gate threshold on the same axis. Fill is green above the gate (transmitting), dim below it (muted), with a live status word; the handle is bright red with a dark edge so it stays legible when the green level sweeps past it. Two level sources: - In-call: the capture thread peak-holds the raw (pre-gate, pre-mute) frame level and emits UiEvent::MicLevel ~10/sec. - Off-call: a "Test mic" toggle runs CoreCommand::SetMicMonitor, spinning up a standalone capture-only stream feeding run_mic_monitor. It shares the backend's single capture stream, so Join tears it down first and leaving Settings releases it; ignored while a session is active. The gate handle drags live via NoiseGateDragging (no disk write per pixel) and persists once on release via NoiseGateChanged. Meter axis is 0..0.3 so a normal voice doesn't peg. Enables the iced "canvas" feature for the custom GateMeter widget. Build + clippy clean, tests pass. Field-verified on desktop. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -12,6 +12,10 @@ pub enum CoreCommand {
|
||||
SetPttActive(bool),
|
||||
SetPeerVolume(EndpointId, f32),
|
||||
SetNoiseGateThreshold(f32),
|
||||
/// Start/stop a standalone capture-only stream that reports the raw mic
|
||||
/// level via [`UiEvent::MicLevel`], for gate calibration outside a call.
|
||||
/// Ignored while a room session is active (the in-call meter covers that).
|
||||
SetMicMonitor { enabled: bool, input_device: Option<String> },
|
||||
/// Set the relay/discovery posture. Takes effect on the next room join,
|
||||
/// since the endpoint is (re)built then.
|
||||
SetNetworkMode(NetworkMode),
|
||||
@@ -30,5 +34,8 @@ pub enum UiEvent {
|
||||
/// Audio link to a peer is up and carrying audio.
|
||||
PeerConnected { id: EndpointId },
|
||||
AudioLevels(Vec<(EndpointId, f32)>),
|
||||
/// Raw (pre-gate, pre-mute) normalized RMS of the local mic, `0.0..=1.0`,
|
||||
/// for the settings level meter. Throttled to ~10/sec.
|
||||
MicLevel(f32),
|
||||
Error(String),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user