Add per-peer listener-side noise gate
Let a listener apply a noise gate to an individual peer's incoming audio — "fix this person's noisy mic / background hum on my end" — which is only possible because full-mesh P2P keeps every peer's stream unmixed locally (server-mixed apps can't do per-listener per-peer DSP). The DSP is the existing mic NoiseGate reused verbatim: it already processes i16 frames at a fixed rate with hysteresis/attack/release/ hangover and takes the threshold per-frame. Wiring mirrors per-peer EQ: - AppConfig.peer_gate map (threshold per peer id; absent/0 = off), persisted, never sent over the wire - CoreCommand::SetPeerGate + Arc<Mutex<HashMap>> shared into the mixer - a live HashMap<EndpointId, NoiseGate> in the mixer task, created lazily and dropped when disabled (no rebuild needed — threshold is passed per frame) - Gate row (threshold slider, "Off" at zero) in each participant card next to Vol/Pan/EQ, persisting on release The gate runs on the raw decoded frame: after the clean multitrack stem tap (recordings stay ungated) but before volume/EQ, so the threshold tracks the peer's true signal level regardless of our volume setting. Same 0..METER_MAX scale as the mic gate. +2 unit tests (config helper); +1 config back-compat assertion. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -259,6 +259,11 @@ pub struct AppConfig {
|
||||
/// string. Local preference only; never sent to peers. Absent entry = unity.
|
||||
#[serde(default)]
|
||||
pub peer_volume: HashMap<String, f32>,
|
||||
/// Per-peer listener-side noise-gate threshold (normalized RMS, `0.0` = off),
|
||||
/// keyed by peer node id string. Local preference only; never sent to peers.
|
||||
/// Absent entry = gate disabled (pass-through).
|
||||
#[serde(default)]
|
||||
pub peer_gate: HashMap<String, f32>,
|
||||
/// Focused app-local keyboard shortcuts.
|
||||
#[serde(default)]
|
||||
pub hotkeys: crate::hotkeys::HotkeyMap,
|
||||
@@ -322,6 +327,7 @@ impl Default for AppConfig {
|
||||
peer_eq: HashMap::new(),
|
||||
peer_pan: HashMap::new(),
|
||||
peer_volume: HashMap::new(),
|
||||
peer_gate: HashMap::new(),
|
||||
hotkeys: crate::hotkeys::HotkeyMap::default(),
|
||||
window_width: default_window_width(),
|
||||
window_height: default_window_height(),
|
||||
@@ -463,6 +469,7 @@ mod tests {
|
||||
assert!(deserialized.peer_eq.is_empty());
|
||||
assert!(deserialized.peer_pan.is_empty());
|
||||
assert!(deserialized.peer_volume.is_empty());
|
||||
assert!(deserialized.peer_gate.is_empty());
|
||||
assert_eq!(
|
||||
crate::hotkeys::format_binding(
|
||||
deserialized
|
||||
|
||||
Reference in New Issue
Block a user