Skip to main content

Module mic_picker

Module mic_picker 

Source
Expand description

<MicPicker /> — live-data dropdown selector for microphones in the Recorder surface (M-MIC.2 / AUT-279).

Mirror of crate::camera_picker for the audio path. Combines the M-MIC.1 IPC helpers with the storybook CaptureSourceRow + DevicePickerMenu shapes (M-UI.8 / AUT-128) to provide:

  • On mount: invoke microphone_permission_status + list_microphones to seed the picker.
  • On open: re-fetch so newly-plugged USB mics + paired Bluetooth headsets appear.
  • On select: invoke start_mic_capture(mic_id) + persist the selection to LocalStorage so re-opens land on the same mic.
  • Permission-denied state uses the same three-state contract as the camera picker (Granted / NotDetermined / Denied).
  • Auto-start on first mount is opt-in via a MicLifecycle::Idle → Starting guard. Unlike the camera path (which auto-starts the preview to make the canvas alive), the mic worker only starts on explicit user click — recording from the mic without the user asking would be surprising even for a default mic.
M-MIC.1's worker uses `autoaudiosrc`, which always opens the OS
default mic regardless of the `mic_id` we send. The picker UX
still works — `start_mic_capture(mic_id)` is the IPC contract —
but the OS-default-only behaviour means clicking a non-default
mic doesn't yet switch the active input. Per-mic wiring
(`osxaudiosrc device-uid=…` etc.) is a follow-up that's a
drop-in extension to the worker's pipeline args; no UI changes
needed.

Structs§

MicPickerBodyProps 🔒
Props for the MicPickerBody component.
MicPickerProps
Props for the MicPicker component.

Functions§

MicPicker
<MicPicker /> — live mic picker rendered alongside the camera picker in the Recorder surface.
MicPickerBody 🔒
Required Props
format_channels 🔒
format_sample_rate 🔒
format_subline 🔒
Build the per-row “48 kHz · stereo · default” subline. 0 values for channels / sample_rate_hz (the “unknown” sentinel from M-MIC.0) are omitted entirely rather than rendered as “0 Hz / 0ch” noise.
read_last_used 🔒
refresh_microphones 🔒
render_row 🔒
resolve_default 🔒
Resolve which mic should be selected on initial mount:
selected_label 🔒
write_last_used 🔒