Skip to main content

Module system_audio_picker

Module system_audio_picker 

Source
Expand description

<SystemAudioPicker /> β€” live-data picker for the speaker / per-app audio capture in the Recorder surface (M-AUDIO-SYS.2 / AUT-279 / AUT-282).

Mirrors crate::mic_picker for the speaker path with two key differences:

  • Master on/off toggle (enabled signal) gates everything. The mic picker has no master toggle because a mic device is always selectable; system audio is opt-in and the toggle is the cleanest UX.
  • Multi-select with bundle-id persistence. Each app row has a checkbox; the selected bundle ids round-trip through LocalStorage so a Spotify selection survives across launches.

Ships the full picker: filter chips (All / None / Suggested / Custom) with the suggested-app heuristic, a 250 ms debounced filter-apply, real app icons (AUT-288 β€” inline PNG data: URLs from the backend, glyph fallback), and the SCK-denial settings deep-link.

StructsΒ§

SystemAudioBodyProps πŸ”’
Props for the SystemAudioBody component.
SystemAudioPickerProps
Props for the SystemAudioPicker component.

EnumsΒ§

ActiveChip πŸ”’
Which filter-chip is visually active given the current picker state. Custom is the implicit β€œuser hand-edited the checkboxes” mode β€” no chip is mapped to it as a click target; it just lights up when none of the other three describe the current selection.

ConstantsΒ§

SUGGESTED_BUNDLE_PREFIXES πŸ”’
Suggested-app heuristic (M-AUDIO-SYS.3 / AUT-288). Best-effort baseline list of bundle-id prefixes the recorder thinks the user probably wants when they click the β€œSuggested” chip: browsers, media / streaming apps, and comm apps. Excludes system services + the recorder itself by omission.

FunctionsΒ§

SystemAudioBody πŸ”’
Required Props
SystemAudioPicker
<SystemAudioPicker /> β€” master toggle + expandable per-app checklist.
apply_filter_from_selection πŸ”’
Build a filter from the current selection and push it to the backend. Empty selection β†’ AllAudio (capture everything); non-empty β†’ OnlyApps (capture just those).
base64_encode πŸ”’
Standard base64 (RFC 4648) of input. Tiny + pure (no dep) so it runs in the native unit tests as well as wasm β€” used to inline the app-icon PNG (AUT-288) as a data: URL.
compute_active_chip πŸ”’
Compute which chip should appear active. Order matters β€” when multiple chips could describe the state (e.g. empty selection could be β€œAll” OR β€œSuggested produced no matches”), the most specific wins.
icon_data_url πŸ”’
A data:image/png;base64,… URL for the app icon (AUT-288), or None when no icon was captured (empty bytes β€” the row then shows its glyph). The backend ships native-size PNGs; None is the headless / no-icon path.
read_enabled πŸ”’
read_selected_ids πŸ”’
render_app_row πŸ”’
same_set πŸ”’
Order-insensitive equality of two bundle-id lists.
schedule_filter_apply πŸ”’
suggested_bundle_ids πŸ”’
Walk the running-app list and pull out bundle ids whose prefix is in SUGGESTED_BUNDLE_PREFIXES.
summary_label πŸ”’
write_enabled πŸ”’
write_selected_ids πŸ”’