feat(audio): stereo mic capture on Windows & macOS desktop clients
Both desktop mics were hard-mono: the core defaults capture_channels=1 and neither client ever called vc_set_capture_channels (only iOS did). Add a persisted "Stereo microphone" toggle to each client's Audio settings, applied when the mic stream starts and live via vc_set_capture_channels + vc_audio_restart. Expose both ABI calls in the Windows interop; the macOS wrapper already had them. Core fix: encode_and_send_frame now folds a stereo mic frame to mono on a mono channel - previously the channels==2 branch encoded interleaved L/R directly even on a mono channel, feeding a mono opus_encode 2x its samples (wrong pitch/garbage). Real stereo still only reaches the wire on a stereo channel; on a mono channel the mic is cleanly downmixed. Test: test_stereo_mic_mono_channel. ctest --preset dev green (28/28). Docs: voice.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
18
PROGRESS.md
18
PROGRESS.md
@@ -26,6 +26,24 @@ up instantly. Newest status at the top.
|
||||
send cushion could be reduced or removed. Shared-core change → add a test and re-verify
|
||||
desktop↔desktop stays low-latency (steady sender ⇒ ~0 arrival jitter ⇒ no regression).
|
||||
|
||||
- **Done (2026-06-23):** **Stereo mic capture on Windows & macOS desktop clients.** Both
|
||||
desktop mics were hard-mono: `ensure_audio_running()` defaults `capture_channels = 1` and
|
||||
neither client ever called `vc_set_capture_channels` (only iOS did). Added a **"Stereo
|
||||
microphone" toggle** to each client's Audio settings (off by default, persisted —
|
||||
`VoiceSettings.StereoMic` on Windows, `MainWindowController.stereoMic` /
|
||||
`voice.stereoMic` UserDefaults on macOS). It's applied to the core when the mic stream
|
||||
starts (stored on the stream before the announce round-trip, so the first device open picks
|
||||
it up) and live in settings via `vc_set_capture_channels` + `vc_audio_restart`. Exposed both
|
||||
ABI calls in the Windows interop (`NativeMethods`/`VoiceCatClient`); the macOS wrapper already
|
||||
had them. **Core fix:** `encode_and_send_frame` (`core/src/core/client.cpp`) now folds a
|
||||
stereo mic frame to mono when the channel is mono — previously the `channels == 2` branch
|
||||
encoded interleaved L/R directly even on a mono channel, feeding a mono `opus_encode` 2× its
|
||||
samples (wrong pitch / garbage). Real stereo still only reaches the wire on a **stereo
|
||||
channel** (encoder channel count = channel's Opus mode); on a mono channel the mic is cleanly
|
||||
downmixed. Test: `test_stereo_mic_mono_channel` in `tests/test_vad_ptt_devices.cpp`. Full
|
||||
`ctest --preset dev` green — 28/28. macOS Xcode build not compiled here (Windows host); the
|
||||
Swift changes follow existing `nrChanged`/`setInputDevice` patterns. Docs: voice.md §8.
|
||||
|
||||
- **Done (2026-06-23):** **Fixed iOS dual-stream / crackly mic — core opened a second
|
||||
(miniaudio) capture device alongside the AVAudioEngine tap.** Symptom: with two clients in
|
||||
a channel, the remote end heard the iOS mic **twice** and crackly. With Voice Chat + a BT
|
||||
|
||||
Reference in New Issue
Block a user