refactor(call): move noise-suppression toggle out of the call bar

Default flipped to off so voice doesn't get coloured by browser NS on
first run. Users turn it on explicitly under Settings → Sprache, where
the toggle already lived before the in-call button shipped.

The in-call SparklesIcon button and all the associated wiring
(onToggleNoiseSuppression, noiseSuppression prop, local subscription
in InCallPanel) is removed. The hot-swap UX is preserved: a new
subscribeAudioSettings watcher in CallContext detects noiseSuppression
flips during an active call and re-runs setupMicPipeline so the change
takes effect without rejoining.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
byGalax
2026-04-22 20:14:57 +02:00
parent eb8f702576
commit 02ca3e3581
4 changed files with 21 additions and 45 deletions
+17
View File
@@ -1235,6 +1235,23 @@ export function CallProvider({ children }: { children: ReactNode }) {
});
}, []);
// Hot-swap the mic track when the user flips noiseSuppression in Settings
// so the change takes effect without needing to rejoin the call. Tracks
// the previous value in a ref so we only re-acquire getUserMedia on
// actual transitions (avoid a rebuild on every unrelated settings save).
useEffect(() => {
let lastNs = getAudioSettings().noiseSuppression;
return subscribeAudioSettings((s) => {
if (s.noiseSuppression === lastNs) return;
lastNs = s.noiseSuppression;
const r = roomRef.current;
if (!r) return;
// setupMicPipeline re-reads audioSettings so the new NS constraint
// gets picked up. Same helper as the initial join + retry paths.
void setupMicPipeline(r);
});
}, [setupMicPipeline]);
// --- Push-to-talk ------------------------------------------------------
// While PTT is active + we're in a connected call, the mic is held off
// except while the configured key is pressed. Under Tauri we also register