Skip to content

Make the audio input state and UI choice-driven (Step C) - #1711

Merged
Mysticial merged 2 commits into
mainfrom
step-c-choice-ui
Oct 24, 2026
Merged

Mysticial merged 2 commits into
mainfrom
step-c-choice-ui

Conversation

@pa-devbot

Copy link
Copy Markdown
Collaborator

Continues the audio pipeline redesign after Step B (#1707): the remaining AudioChannelFormat preset consumers now run on the device-driven AudioInputChoice.

What changes

  • AudioSession: input_format()/set_format() become input_choice()/set_input_choice(); sanitize_format() becomes sanitize_choice(), validating the stored choice against the device's supported_choices(); the post_input_change state callback carries the choice.
  • AudioPassthroughPair (abstract + Qt + QtThread): reset() and set_audio_source(device) take the resolved choice; the pair no longer resolves presets itself (the session guarantees validity).
  • AudioOption: persists the choice's display name under the same InputFormat JSON key; loading matches it against the device's choices.
  • AudioSelectorWidget: the format dropdown is built from supported_choices() + display names (replaces supported_formats()/AUDIO_FORMAT_LABELS).
  • StreamHistorySession: start()/post_input_change() take the choice.
  • AudioInputChoice: gains operator== (validity-guarded) and user-provided copy ctor / assignment / destructor defined in AudioInfo.cpp, so TUs passing choices by value never instantiate Pimpl<QAudioFormat> themselves — AudioSession.cpp no longer includes Pimpl.tpp at all (the Step B CI link fix stays structurally sound on clang+ld.bfd; nm shows no object with an undefined Pimpl reference).
  • Removes resolve_input_choice() (the Step B preset→choice bridge, now dead) and its test; adds an AudioInputChoice equality gate test.

Behavior notes

  • Saved configs: a native-shape entry still matches (old labels == new display names for native presets). A saved INTERLEAVE entry (old physical-shape label "1 x 96,000 Hz (Interleaved ...)") won't match the new logical-shape display name and falls back to the device's preferred choice — one-time, user-visible in the dropdown.
  • File input clears the format dropdown as before; the pipeline still consumes the file's native shape.
  • Unresolvable/changed-device choices fall back to preferred_choice_index(), same as the preset fallback.

Test

Full suite: 18,277 passed / 0 failed / 0 skipped (3 decode tests included via pinned ffmpeg backend).

Move the remaining preset (AudioChannelFormat) consumers onto the
device-driven AudioInputChoice introduced in Steps A/B:

- AudioSession: input_format()/set_format() become input_choice()/
  set_input_choice(); sanitize_format() becomes sanitize_choice()
  (validates the stored choice against the device's supported_choices());
  the post_input_change state callback now carries the choice.
- AudioPassthroughPair (+ Qt / QtThread backends): reset() and
  set_audio_source(device) take the resolved AudioInputChoice instead of
  the preset; the pair no longer resolves presets itself.
- AudioOption: persists the choice's display name (JSON key unchanged);
  load matches it against the device's supported choices.
- AudioSelectorWidget: the format dropdown is built from
  supported_choices() and its display names instead of
  supported_formats()/AUDIO_FORMAT_LABELS.
- StreamHistorySession: start()/post_input_change() take the choice.
- AudioInputChoice gains operator== (validity-guarded) and user-provided
  copy ctor / assignment / destructor, defined in AudioInfo.cpp, so TUs
  passing choices by value never instantiate Pimpl<QAudioFormat>
  themselves (AudioSession.cpp no longer needs Pimpl.tpp at all).
- resolve_input_choice() (the Step B preset->choice bridge) and its test
  are removed now that nothing resolves presets; replaced by an
  AudioInputChoice equality gate test.

Behavior notes:
- A saved config's format entry that names a native shape still matches
  (labels and choice display names coincide); a saved INTERLEAVE entry
  (old physical-shape label) falls back to the device's preferred choice.
- File input clears the format dropdown as before; the pipeline still
  consumes the file's native shape.
@Mysticial
Mysticial merged commit e3c7d18 into main Oct 24, 2026
7 checks passed
@Mysticial
Mysticial deleted the step-c-choice-ui branch October 24, 2026 22:30
Mysticial pushed a commit that referenced this pull request Oct 24, 2026
Deletes the last of the fixed input-format preset machinery, now that the
pipeline, session state, options/JSON, and UI all run on the device-driven
AudioInputChoice (Steps A-C, #1678 / #1707 / #1711):

- AudioChannelFormat enum, AUDIO_FORMAT_LABELS, and set_format().
- AudioDeviceInfo::supported_formats() / preferred_format_index() and the
  dead preferred_format(); the legacy supported_input_formats() grid-to-
  preset mapping (its #if 0 debug remnants included).
- all_input_devices(): the same-display-name dedupe now scores on the
  number of input choices instead of the legacy format list (+ the
  preferred-preset-match bonus, which has no choice-world analogue); the
  winMM shadow-device comment notes QTBUG-75781 is a Qt5-era artifact that
  no longer occurs on Qt6.
- Stale comments in AudioInfo_Tests and StreamHistorySession::clear().

The shared enumerate_supported_formats() grid probe stays: it feeds
build_input_choices(). format_to_str() stays: it is still used to log
output device preferred formats.

Co-authored-by: PA Dev Bot <344001113+pa-devbot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants