hex/src/audio
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Dax 689e5b35e9
labs: keep the microphone open after dictating (#1701)
* labs: keep the microphone open after dictating

With Release microphone while idle on, a capture that ends now leaves the
microphone open for a Labs window (`labs.keep_microphone_open` +
`labs.keep_microphone_open_seconds`: 30 s, 1, 3, 5, or 30 minutes, default
1 minute), so the next dictation takes the warm path with its pre-roll
instead of the cold open's asynchronous start. Off, every listener closes
exactly as before, and with the release setting off the lab does nothing.

One `audio::linger::MicrophoneLinger` decides it for macOS, Windows, and
Linux: the first idle pass after a capture arms the window, a capture clears
it, and only a later idle pass past the window closes, once nothing records,
no client dictates, no release tail runs, and no capture copies the
microphone. Windows and Linux move their repeated `release_while_idle &&
!wants_audio()` closes into that one check; macOS reconciles through it. The
switch takes the Labs state word's last free bit; the window has no room
there, so it lives in its own atomic, both written by `labs::apply`.

Also moves Linux's Live typing glue into `linux/dictation/typing.rs`, since
`linux/dictation.rs` was at the source cap, and regenerates the Labs goldens
for the new card.

* labs: release the lingering microphone where the old sites did

Review fixes for keep-microphone-open:

* macOS reconcile_input keeps origin/dev's branches: with a capture sink
  open and an inactive input, recovery is still requested, and the lab's
  window is cleared while a sink holds the microphone.
* A digital-silence finish closes a lingering microphone instead of
  skipping recovery, so the next press opens a fresh stream. macOS does it
  in reopen_silent_stream; Linux's moved to linux/dictation/silence.rs
  (which also keeps linux/dictation.rs under the source cap). Windows has
  no digital-silence path.
* Windows and Linux run the release check at the old event sites (a
  submitted finish, a cancel, a discard before the open, a client's end)
  through one small macro, so a press handled in the same pass still sees
  a closed microphone when the lab is off. That check also releases a
  microphone an interrupted recording left open, which the old
  latch-based sites never did.
* Docs: drop the "exactly as before" claims, describe the extra close, the
  Annotate capture-sink and local-API windows, macOS ending the window on
  a stream interruption, and the Linux poll rather than an idle wait.
* clear() is real code now (the silence close); state()/apply() say why
  the switch bit and the window atomic are written separately.

* labs: keep the lab's windows and spots exact

Follow-ups from review:

* Windows releases the microphone when a pending client dictation's start
  gives up at the first chunk, which the old site closed too.
* macOS leaves a lingering microphone alone when a digital-silence finish
  lands while a capture sink copies it, so Annotate gets no gap.
* The Linux silence test's released case opens the input first, so it really
  covers "lab off, release while idle: no reopen, stream stays open".
* Docs say where a digital-silence finish ends the window (macOS and Linux,
  not with a capture sink on macOS) and that Windows can linger on a
  zero-only stream.
2026-11-11 18:12:08 -05:00
..
hex_microphone Extract macos_hal and pipewire_source from audio/hex_microphone.rs 2026-10-31 18:57:51 -07:00
recording_environment Fold audio and recording-environment modules into audio/ 2026-10-31 16:12:40 -07:00
browser_media.rs Fold audio and recording-environment modules into audio/ 2026-10-31 16:12:40 -07:00
call_input.rs Meetings: record the input the call app uses (#1086) (#1091) 2026-11-03 00:14:23 -05:00
fixture.rs audio: keep overload reporting off CoreAudio's real-time thread (#1643) 2026-11-10 13:17:35 -05:00
hex_microphone.rs Extract macos_hal and pipewire_source from audio/hex_microphone.rs 2026-10-31 18:57:51 -07:00
idle_sleep.rs Fold audio and recording-environment modules into audio/ 2026-10-31 16:12:40 -07:00
input_format.rs fix: renegotiate the mic's sample rate after digital silence (#1575) (#1693) 2026-11-11 09:30:51 -05:00
input_level.rs fix: ignore microphone dc offset in level meters (#1560) 2026-11-08 17:41:24 -05:00
instant.rs Extract instant and lid from audio.rs 2026-10-31 18:57:51 -07:00
lid.rs Extract instant and lid from audio.rs 2026-10-31 18:57:51 -07:00
linger.rs labs: keep the microphone open after dictating (#1701) 2026-11-11 18:12:08 -05:00
mix_format.rs windows: try iaudioclient3, interface activation and auto-convert wasapi paths (#1270) 2026-11-04 08:49:05 -05:00
output_ducking.rs lower audio faster and drop duck pre-roll (#1482) 2026-11-07 05:11:08 -05:00
output_route.rs chore(fixtures): remove personal data from preview fixtures (#1676) 2026-11-10 20:11:38 -08:00
overloads.rs audio: keep overload reporting off CoreAudio's real-time thread (#1643) 2026-11-10 13:17:35 -05:00
recording_environment.rs labs: apply While dictating only on speakers (#1610) 2026-11-09 20:24:42 -05:00
recovery.rs fix: renegotiate the mic's sample rate after digital silence (#1575) (#1693) 2026-11-11 09:30:51 -05:00
transport.rs Fix #1100: automatic microphone fallback selection (#1184) 2026-11-03 14:56:13 -05:00
voice_filter.rs Fold audio and recording-environment modules into audio/ 2026-10-31 16:12:40 -07:00
wasapi_capture.rs windows: go back to cpal first, with the direct wasapi paths as fallback (revert #1279) (#1365) 2026-11-05 03:14:15 -05:00