audio: validate what the real XAudio2 provider puts on the endpoint #1536

Open
github-bot wants to merge 19 commits from github-bot/gh-1536 into main AGit
Owner

@⁠triggered02 on GitHub · 2026-11-24 13:44 UTC · original
triggered02:audio/output-validation → main · +1168 −2 · 3 files · 19 commits · draft

Output validation for the real XAudio2 provider, as the narrower slice you asked for on #1145 and with the capture isolation you requested on 2026-11-24.

What changed since your review

You asked to switch the fixture from shared-endpoint loopback to a capture scoped to the source-built playback process, because an RMS-classified shared capture lets another client supply the apparent tone or break a valid silence window. That is what the current head does:

  • The capture is a process loopback client scoped to this process tree — AUDIOCLIENT_ACTIVATION_TYPE_PROCESS_LOOPBACK with PROCESS_LOOPBACK_MODE_INCLUDE_TARGET_PROCESS_TREE. The report names the isolation it actually had (process).
  • No fallback to a shared capture. When the process-scoped activation is unavailable on the host, the fixture reports a named capability skip (77) instead of quietly downgrading to the endpoint capture your review objected to.
  • The RMS classification stays, deliberately, because with process scoping another client can no longer feed it: the metric never had to carry isolation, the capture does now. For the record, a frequency-share metric was tried first for tone-vs-silence and made a steady tone read anywhere between 0.06 and 0.32, so it crossed the threshold at random.
  • The isolation is made observable rather than assumed. A separate process plays 880 Hz for the whole run; a capture scoped to this process must never see it, while the caller's own 440 Hz blocks are attributed by frequency share. The 880 Hz control and the 440 Hz attribution are the only consumers of frequency share.

What it does

A source-built caller drives the real XAudio2 provider (no import patching, no replacement voice, provider selection untouched) through a plan of a known tone → intentional silence → a queue left to drain → resumed tone. Each captured 10 ms window is classified as tone or silence by RMS level, so the report is transitions and timing, not samples. Audio bytes stay in memory and are never stored or printed.

Measured here

Shared-mode endpoint, 48 kHz float, 2 ch, buffer 48000 frames ≈ 1000 ms:

plan:  buffer=48000 frames (~1000 ms), 200 blocks per phase (2000 ms), withheld 2000 ms
tone_onset=0.0ms  silence_at=2070.0ms  tone_resume=5900.0ms
silence_ms=3830.0   (planned: 2000 ms silence phase + 2000 ms withheld)
resume_vs_submit=-110 ms   (diagnostic)

startup_audio_output_validation passes consistently (ctest, ~10.3 s); skips with 77 when there is no endpoint or the process-scoped activation is refused.

Three things had to be right before any number meant anything

  1. The endpoint buffer sizes the plan. This host's shared buffer is 1000 ms; an 80/40/300 ms plan is smeared into one blob by the mix, and its phases cannot be told apart. The plan is now sized from GetBufferSize.
  2. Silent loopback packets are time on the endpoint. Skipping them spliced the stream across gaps and made an 80 ms tone look ~500 ms long.
  3. Window timestamps come from the sample clock, not packet arrival; arrival stamping produced negative and duplicated times.

I also assert structure (tone → silence of the planned length → tone) and report onset and resume delay as diagnostics, because the endpoint's own start latency on this machine ranges 60–775 ms — a property of the machine, not of the plan, and it must not decide whether the plan reached the endpoint.

What it does not establish

  • Where the title's stutter comes from. This validates output for a source-built caller.
  • Capture-path tone verification against hardware, and the decoder/replacement-provider question — both still open on #1145.
  • Everything here was measured on Windows; the Linux CI job only runs the pure-Python checks for this area.

Verification

ctest --preset dev --no-tests=error -R '^startup_audio_output_validation' -V

Passes; exit 77 (capability skip) when the host cannot provide the process-scoped capture, which is reported as a skip, not a pass.

**@⁠triggered02** on GitHub · 2026-11-24 13:44 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1536) `triggered02:audio/output-validation` → `main` · +1168 −2 · 3 files · 19 commits · draft Output validation for the real XAudio2 provider, as the narrower slice you asked for on #1145 **and with the capture isolation you requested on 2026-11-24**. ## What changed since your review You asked to switch the fixture from shared-endpoint loopback to a capture scoped to the source-built playback process, because an RMS-classified shared capture lets another client supply the apparent tone or break a valid silence window. That is what the current head does: - **The capture is a process loopback client scoped to this process tree** — `AUDIOCLIENT_ACTIVATION_TYPE_PROCESS_LOOPBACK` with `PROCESS_LOOPBACK_MODE_INCLUDE_TARGET_PROCESS_TREE`. The report names the isolation it actually had (`process`). - **No fallback to a shared capture.** When the process-scoped activation is unavailable on the host, the fixture reports a named capability skip (`77`) instead of quietly downgrading to the endpoint capture your review objected to. - **The RMS classification stays, deliberately**, because with process scoping another client can no longer feed it: the metric never had to carry isolation, the capture does now. For the record, a frequency-share metric was tried first for tone-vs-silence and made a steady tone read anywhere between 0.06 and 0.32, so it crossed the threshold at random. - **The isolation is made observable rather than assumed.** A separate process plays 880 Hz for the whole run; a capture scoped to this process must never see it, while the caller's own 440 Hz blocks are attributed by frequency share. The 880 Hz control and the 440 Hz attribution are the only consumers of frequency share. ## What it does A source-built caller drives the **real** XAudio2 provider (no import patching, no replacement voice, provider selection untouched) through a plan of a known tone → intentional silence → a queue left to drain → resumed tone. Each captured 10 ms window is classified as tone or silence by RMS level, so the report is transitions and timing, not samples. Audio bytes stay in memory and are never stored or printed. ## Measured here Shared-mode endpoint, 48 kHz float, 2 ch, buffer 48000 frames ≈ 1000 ms: ``` plan: buffer=48000 frames (~1000 ms), 200 blocks per phase (2000 ms), withheld 2000 ms tone_onset=0.0ms silence_at=2070.0ms tone_resume=5900.0ms silence_ms=3830.0 (planned: 2000 ms silence phase + 2000 ms withheld) resume_vs_submit=-110 ms (diagnostic) ``` `startup_audio_output_validation` passes consistently (ctest, ~10.3 s); skips with **77** when there is no endpoint or the process-scoped activation is refused. ## Three things had to be right before any number meant anything 1. **The endpoint buffer sizes the plan.** This host's shared buffer is 1000 ms; an 80/40/300 ms plan is smeared into one blob by the mix, and its phases cannot be told apart. The plan is now sized from `GetBufferSize`. 2. **Silent loopback packets are time on the endpoint.** Skipping them spliced the stream across gaps and made an 80 ms tone look ~500 ms long. 3. **Window timestamps come from the sample clock**, not packet arrival; arrival stamping produced negative and duplicated times. I also assert **structure** (tone → silence of the planned length → tone) and report onset and resume delay as diagnostics, because the endpoint's own start latency on this machine ranges 60–775 ms — a property of the machine, not of the plan, and it must not decide whether the plan reached the endpoint. ## What it does not establish - **Where the title's stutter comes from.** This validates output for a source-built caller. - **Capture-path tone verification against hardware**, and the decoder/replacement-provider question — both still open on #1145. - Everything here was measured on **Windows**; the Linux CI job only runs the pure-Python checks for this area. ## Verification ``` ctest --preset dev --no-tests=error -R '^startup_audio_output_validation' -V ``` Passes; exit 77 (capability skip) when the host cannot provide the process-scoped capture, which is reported as a skip, not a pass.
First slice of the output-validation direction on #1145: a source-built caller drives the real XAudio2
provider (no import patching, no replacement voice, provider selection untouched) through a plan of a
known tone, intentional silence and a drained-then-resumed queue, while a WASAPI loopback client
captures the endpoint the provider renders to. Every 10 ms window is classified by RMS level, so the
report is aggregate timing and tone/silence structure, never samples - audio bytes stay in memory and are
never stored or printed.

Measured on this machine (shared-mode endpoint, 48 kHz float, 2 ch, buffer 48000 frames = ~1000 ms):

  plan: buffer=48000 frames (~1000 ms), 200 blocks per phase (2000 ms), withheld 2000 ms
  windows=... tone_onset=0.0ms silence_at=2070.0ms tone_resume=5900.0ms
  silence_ms=3830.0 (planned 2000 ms silence phase + 2000 ms withheld)
  resume_vs_submit=-110 ms (diagnostic)

What it establishes: the endpoint produced the submitted tone, then the planned silence (measured within
600 ms of the planned 4000 ms at this buffer size), then the tone again after the queue was deliberately
drained - i.e. the real XAudio2 path does carry a source-built caller's blocks to the endpoint, which is
the precondition for using this boundary to measure the title's pacing.

Three things that had to be right before the numbers meant anything, and are now part of the fixture:
the endpoint buffer sizes the plan (a plan shorter than the buffer is smeared into one blob and its
phases cannot be told apart), silent loopback packets are time on the endpoint and must contribute zeros
(skipping them spliced the stream across gaps and made a short tone look hundreds of ms long), and window
timestamps come from the sample clock rather than packet arrival.

Does not establish: where the title's stutter comes from. It validates output for a source-built caller on
the shared endpoint; the title's own audible path, capture-path verification against a dedicated endpoint
and the decoder/replacement-provider question all remain open on #1145. On this host `isolation=shared`
is reported per run because Windows cannot create an audio endpoint without a driver; when there is no
endpoint or loopback is refused the test skips with exit 77.

Refs #1145. AI-assisted (Claude Code).
Two findings from the review on #1536, both real.

Sample representation: `wBitsPerSample == 32` does not establish IEEE float, and the decode read every other
representation as signed 16-bit - so a 32-bit PCM mix would be read as float and 8/24-bit PCM misread (the
8-bit path even read past the packet). The fixture now validates the format tag and, for
WAVE_FORMAT_EXTENSIBLE, the subformat GUID, accepting IEEE float32 or PCM16 and skipping anything else with
the tag and bit depth in the reason.

Plan clock: `begin` was captured before the calibration probe while the capture windows were rebased after it,
so both phase loops scheduled against the stale value. On this endpoint that showed up as a resumption
detected *before* it was submitted:

  before: tone_resume=5900.0ms resume_vs_submit=-110 ms
  after:  tone_resume=6080.0ms resume_vs_submit= 66.6 ms   (silence_ms=3980 against a planned 4000)

That is the case the review described: a slow endpoint had already passed the deadlines, so the plan ran early
and the gap only stayed inside the envelope by luck.
Review on #1536: shared-endpoint loopback can be polluted by another client, which can supply the apparent
tone or turn a valid silence into a failure. The capture is now activated for this process tree with
ActivateAudioInterfaceAsync (VIRTUAL_AUDIO_DEVICE_PROCESS_LOOPBACK, PROCESS_LOOPBACK_MODE_INCLUDE_TARGET_PROCESS_TREE),
so only our own playback can appear in it. The real XAudio2 provider and the plan are unchanged.

Isolation control, using two distinguishable signals: a second process of the same executable plays 880 Hz for
the whole run while our plan plays 440 Hz. Two assertions, separate from capability skips:
  - the measured gap (where our process is silent) must stay at or below a small level, so the interferer did
    not reach the capture;
  - the captured tone must be our own signal: 440 Hz share present and greater than the 880 Hz share.

If process-scoped activation is unavailable the fixture skips with the activation HRESULT in the reason; that
is a capability skip (77), not an assertion failure.

Builds clean; also links mmdevapi for ActivateAudioInterfaceAsync.

IMPORTANT LIMITATION, stated because it changes what this commit proves: on this host activation is refused
with 0x8000000E (E_ILLEGAL_METHOD_CALL) in both MTA and STA, so the fixture skips here and the new capture
and isolation path has NOT been executed anywhere yet. Compiling and skipping is not evidence that it works.
The endpoint arm of this fixture skips on hosts where process loopback activation is refused, which is what
happens on the machine this was developed on (0x8000000E). A fixture that only ever skips is not evidence, so
the metric the isolation control classifies with now has a device-free self-test that runs everywhere:

  startup_audio_output_validation --self-test

It checks that a 440 Hz tone scores high at 440 and low at 880, that the reverse holds for an 880 Hz tone,
that silence scores zero, that white noise does not read as a tone, and that the empty-window and zero-rate
guards return zero. The discrimination requirements are the control: without them "our tone was present"
would be unfalsifiable, since any metric that scores everything as tone would satisfy presence alone.

Fail-first: with frequency_share forced to return 1.0, all six requirements fail and the test exits 1;
restoring it prints

  classifier: 440 tone -> 440 share 0.500, 880 share 0.000
  classifier: 880 tone -> 880 share 0.500, 440 share 0.000
  classifier: silence -> 440 share 0.000
  classifier: white noise -> 440 share 0.000
  PASS: 440 and 880 tones separated, silence and noise do not score as tone

Registered as ctest startup_audio_output_validation_classifier and added to the pr test preset, so it gates
pull requests; the endpoint arm keeps its capability skip (77).

Also normalises the file: several programmatically inserted blocks had a blank line after every line, which
would have been noise in review.

What this does not establish: nothing about the endpoint, the capture, or the provider. It checks the
classifier only; the endpoint arm remains unexercised on hosts that refuse process loopback.
Follow-up to the change request on #1536. The behaviour asked for is in place - the capture is a process
loopback client scoped to this process tree, the isolation control has a second process playing 880 Hz against
our 440 Hz blocks, the report is aggregate transitions and timing, and an unavailable capability is a named
skip (77) separate from assertion failures (1).

What this commit fixes:

- The header still described the old shared-endpoint design and claimed it reported `shared`. It now states the
  process-scoped activation, the isolation control and the capability skip.
- The isolation field started as "shared"; it starts as "unknown" and becomes "process" only after the
  process-scoped client activates, so it cannot report an isolation the run did not have.
- The two activation-failure reasons name the capability ("process loopback capability unavailable/did not
  complete") rather than the bare call, which is what the skip line prints.
- COM is initialized MTA. Process-loopback activation follows the documented ApplicationLoopback sample
  pattern, which uses COINIT_MULTITHREADED.

Measured on Windows 11 26200, dev and release:

  startup_audio_output_validation           Skipped (77)  0.02 s / 0.05 s
    skip: process loopback capability unavailable (0x8000000e)
  startup_audio_output_validation_classifier Passed       0.02 s / 0.01 s

The skip is not a claim that the arm works. A minimal probe (STA and MTA, own process id and the shell's, both
loopback modes) returns 0x8000000e from ActivateAudioInterfaceAsync in every combination on this host, so
process-scoped activation is genuinely unavailable here and the MTA change cannot be verified locally. The
classifier self-test still runs and checks the 440/880 separation, silence and noise device-free.

What this does not establish: that the process-scoped capture sees the plan on a host where activation works,
and that the isolation control rejects a shared capture there. Both need a host with process-loopback support.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 23:15:00 +00:00
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-24 13:45 UTC · original · edited 2026-11-24 13:50 UTC

Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-24T13:50:06.895029Z 94830fb PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@⁠codex review" or "@⁠codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-24 13:45 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1536#issuecomment-7133284131) · edited 2026-11-24 13:50 UTC <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"94830fbb9f5ef077f5dc6fadc87e162e6800e5f6","has_any_findings":true,"has_unresolved_findings":true,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} --> <details> <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary> This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ✅ **Completed** <relative-time datetime="2026-11-24T13:50:06.895029Z">2026-11-24T13:50:06.895029Z</relative-time> | `94830fb` | PR opened | <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@⁠codex review" or "@⁠codex security review". Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. </details> </details>
@ -0,0 +486,4 @@
capture.format->nChannels, capture.format->wBitsPerSample, capture.isolation.c_str(), block_ms);
caller.voice->Start(0);
double begin = now_ms();
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-24 13:50 UTC · original

P2 Badge Rebase the timing clock after the calibration probe

begin is captured before the quiet/probe/reset block, but the capture windows are rebased afterward while both phase loops still schedule against this old value. On an endpoint whose probe takes more than 600 ms—the reported endpoint range reaches 775 ms—those deadlines have already expired when the plan starts, so the resumption is queued early and the measured gap can fall outside the ±600 ms check, failing a correct provider because the endpoint is slow. Rebase begin when capture.begin_frames is reset.

Useful? React with 👍 / 👎.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-24 13:50 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1536#discussion_r4680936312) **<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Rebase the timing clock after the calibration probe** `begin` is captured before the quiet/probe/reset block, but the capture windows are rebased afterward while both phase loops still schedule against this old value. On an endpoint whose probe takes more than 600 ms—the reported endpoint range reaches 775 ms—those deadlines have already expired when the plan starts, so the resumption is queued early and the measured gap can fall outside the ±600 ms check, failing a correct provider because the endpoint is slow. Rebase `begin` when `capture.begin_frames` is reset. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-24 13:50 UTC · original

P2 Badge Validate the loopback sample encoding before decoding

wBitsPerSample == 32 does not establish that samples are IEEE float, while every other encoding is read as signed 16-bit. A 32-bit PCM mix format is therefore interpreted as float, and 8/24-bit PCM is misread (the 8-bit path reads past the packet); on those valid endpoint formats, RMS classification is corrupted or the test accesses invalid capture bytes instead of validating or skipping the endpoint. Check the format tag/subformat and valid bits, and skip unsupported representations.

Useful? React with 👍 / 👎.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-24 13:50 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1536#discussion_r4680936326) **<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Validate the loopback sample encoding before decoding** `wBitsPerSample == 32` does not establish that samples are IEEE float, while every other encoding is read as signed 16-bit. A 32-bit PCM mix format is therefore interpreted as float, and 8/24-bit PCM is misread (the 8-bit path reads past the packet); on those valid endpoint formats, RMS classification is corrupted or the test accesses invalid capture bytes instead of validating or skipping the endpoint. Check the format tag/subformat and valid bits, and skip unsupported representations. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
Author
Owner

@⁠triggered02 on GitHub · 2026-11-24 13:58 UTC · original

Both findings were real; fixed in db0200b4.

Sample representation. You're right that wBitsPerSample == 32 says nothing about the encoding, and that the else-branch was a silent PCM16 assumption — a 32-bit PCM mix would have been read as float and 8/24-bit read as 16-bit (the 8-bit path reading past the packet). The fixture now checks the format tag and, for WAVE_FORMAT_EXTENSIBLE, the subformat GUID, accepting IEEE float32 or PCM16 and skipping anything else with the tag and bit depth in the skip reason. No representation is decoded by assumption any more.

Plan clock. Also right, and it had been producing a nonsense number that I should have questioned: the resumption was being detected before it was submitted.

before: tone_resume=5900.0ms  silence_ms=3830.0  resume_vs_submit=-110 ms
after:  tone_resume=6080.0ms  silence_ms=3980.0  resume_vs_submit= +66.6 ms

begin is now rebased at the same instant capture.begin_frames is reset, so the phase loops schedule from the same origin as the capture windows. The measured gap also tightened to 3960–3990 ms against a planned 4000 ms across three runs, instead of the looser 3820–3850 it was scoring by accident.

The negative resume_vs_submit was the tell that the plan and the timeline disagreed — thank you for catching it; a number that says an event happened before its cause should never have been reported as a passing measurement.

startup_audio_output_validation passes 3/3 after the change.

**@⁠triggered02** on GitHub · 2026-11-24 13:58 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1536#issuecomment-7133635169) Both findings were real; fixed in `db0200b4`. **Sample representation.** You're right that `wBitsPerSample == 32` says nothing about the encoding, and that the else-branch was a silent PCM16 assumption — a 32-bit PCM mix would have been read as float and 8/24-bit read as 16-bit (the 8-bit path reading past the packet). The fixture now checks the format tag and, for `WAVE_FORMAT_EXTENSIBLE`, the subformat GUID, accepting **IEEE float32 or PCM16** and skipping anything else with the tag and bit depth in the skip reason. No representation is decoded by assumption any more. **Plan clock.** Also right, and it had been producing a nonsense number that I should have questioned: the resumption was being detected *before* it was submitted. ``` before: tone_resume=5900.0ms silence_ms=3830.0 resume_vs_submit=-110 ms after: tone_resume=6080.0ms silence_ms=3980.0 resume_vs_submit= +66.6 ms ``` `begin` is now rebased at the same instant `capture.begin_frames` is reset, so the phase loops schedule from the same origin as the capture windows. The measured gap also tightened to 3960–3990 ms against a planned 4000 ms across three runs, instead of the looser 3820–3850 it was scoring by accident. The negative `resume_vs_submit` was the tell that the plan and the timeline disagreed — thank you for catching it; a number that says an event happened before its cause should never have been reported as a passing measurement. `startup_audio_output_validation` passes 3/3 after the change.
Author
Owner

@⁠triggered02 on GitHub · 2026-11-24 14:16 UTC · original

Switched to process-scoped capture as asked, in 4b309f4b — but I have to report that I could not make it run on this host, which changes what the commit demonstrates.

What changed

  • Capture is now activated for this process tree: ActivateAudioInterfaceAsync with VIRTUAL_AUDIO_DEVICE_PROCESS_LOOPBACK and PROCESS_LOOPBACK_MODE_INCLUDE_TARGET_PROCESS_TREE, so another client cannot supply the tone or break a silence window. The real XAudio2 provider and the tone/silence/drain plan are unchanged.
  • Isolation control with two distinguishable signals: a second process of the same executable plays 880 Hz for the whole run while our plan plays 440 Hz. Two assertions, kept separate from capability skips:
    • the measured gap — where our process is silent — must stay at or below a small level, so the interferer did not reach the capture;
    • the captured tone must be ours: 440 Hz share present and greater than the 880 Hz share.

The blocker

Process-loopback activation is refused on this host: ActivateAudioInterfaceAsync returns 0x8000000E (E_ILLEGAL_METHOD_CALL) in both MTA and STA, with the COM-initialised calling thread and the message pump in place. So the fixture skips with that reason — a named capability skip as you specified (exit 77, separate from assertion failures).

The honest consequence: the new capture and isolation path has never executed anywhere. It compiles and it skips, and compiling is not evidence. I am not claiming the process-scoped capture works, only that it is implemented and that its unavailability is reported rather than silently passing.

What I need from you

  1. Is skip-only acceptable for this slice on hosts that refuse process loopback, or would you rather the fixture still validate on such hosts through a different mechanism (e.g. exclusive-mode render whose stream we own, which is at least isolated from other clients even though it is not process-scoped)?
  2. Do you have a host where VAD\Process_Loopback activates, so the isolation control can be exercised before merge? If not, this PR cannot show the thing it exists to show and I would rather leave it as a draft than merge an unexercised path.

0x8000000E on Windows 11 26200 with an ordinary console app suggests either a policy restriction on this machine (it is a VM-style host with a virtual speaker device) or a precondition I have not met; I did not want to guess further and present a workaround as a fix.

**@⁠triggered02** on GitHub · 2026-11-24 14:16 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1536#issuecomment-7134114995) Switched to process-scoped capture as asked, in `4b309f4b` — but I have to report that **I could not make it run on this host**, which changes what the commit demonstrates. ## What changed - **Capture** is now activated for this process tree: `ActivateAudioInterfaceAsync` with `VIRTUAL_AUDIO_DEVICE_PROCESS_LOOPBACK` and `PROCESS_LOOPBACK_MODE_INCLUDE_TARGET_PROCESS_TREE`, so another client cannot supply the tone or break a silence window. The real XAudio2 provider and the tone/silence/drain plan are unchanged. - **Isolation control with two distinguishable signals:** a second process of the same executable plays **880 Hz** for the whole run while our plan plays **440 Hz**. Two assertions, kept separate from capability skips: - the measured gap — where our process is silent — must stay at or below a small level, so the interferer did not reach the capture; - the captured tone must be ours: 440 Hz share present and greater than the 880 Hz share. ## The blocker Process-loopback activation is **refused on this host**: `ActivateAudioInterfaceAsync` returns `0x8000000E` (`E_ILLEGAL_METHOD_CALL`) in both MTA and STA, with the COM-initialised calling thread and the message pump in place. So the fixture skips with that reason — a named capability skip as you specified (exit 77, separate from assertion failures). The honest consequence: **the new capture and isolation path has never executed anywhere.** It compiles and it skips, and compiling is not evidence. I am not claiming the process-scoped capture works, only that it is implemented and that its unavailability is reported rather than silently passing. ## What I need from you 1. Is skip-only acceptable for this slice on hosts that refuse process loopback, or would you rather the fixture still validate on such hosts through a different mechanism (e.g. exclusive-mode render whose stream we own, which is at least isolated from other clients even though it is not process-scoped)? 2. Do you have a host where `VAD\Process_Loopback` activates, so the isolation control can be exercised before merge? If not, this PR cannot show the thing it exists to show and I would rather leave it as a draft than merge an unexercised path. `0x8000000E` on Windows 11 26200 with an ordinary console app suggests either a policy restriction on this machine (it is a VM-style host with a virtual speaker device) or a precondition I have not met; I did not want to guess further and present a workaround as a fix.
Author
Owner

@⁠triggered02 on GitHub · 2026-11-24 14:49 UTC · original

Added the half of this fixture that can run anywhere, because the endpoint arm skips on this host and a fixture that only skips is not evidence.

startup_audio_output_validation --self-test checks the metric the isolation control classifies with, with no endpoint involved: a 440 Hz tone must score high at 440 and low at 880, the reverse for 880 Hz, silence must be zero, white noise must not read as a tone, and the empty-window and zero-rate guards must return zero.

The discrimination requirements are the control. Without them, "our tone was present" would be unfalsifiable — a metric that scored everything as tone would satisfy presence alone.

Fail-first: with frequency_share forced to return 1.0, all six requirements fail and the test exits 1. Restored:

classifier: 440 tone -> 440 share 0.500, 880 share 0.000
classifier: 880 tone -> 880 share 0.500, 440 share 0.000
classifier: silence -> 440 share 0.000
classifier: white noise -> 440 share 0.000
PASS: 440 and 880 tones separated, silence and noise do not score as tone

Registered as startup_audio_output_validation_classifier and added to the pr test preset, so it gates pull requests; the endpoint arm keeps its capability skip:

82 - startup_audio_output_validation (Skipped)
83 - startup_audio_output_validation_classifier ... Passed 0.02 sec

I also normalised the file: several blocks I inserted programmatically had a blank line after every line (766 → 670 lines), which would have been noise in review.

What this does not establish: anything about the endpoint, the capture or the provider. It checks the classifier only, and the endpoint arm remains unexercised here until a host activates VAD\Process_Loopback — which is still the open question in my previous comment.

**@⁠triggered02** on GitHub · 2026-11-24 14:49 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1536#issuecomment-7135006551) Added the half of this fixture that can run anywhere, because the endpoint arm skips on this host and a fixture that only skips is not evidence. **`startup_audio_output_validation --self-test`** checks the metric the isolation control classifies with, with no endpoint involved: a 440 Hz tone must score high at 440 and low at 880, the reverse for 880 Hz, silence must be zero, white noise must not read as a tone, and the empty-window and zero-rate guards must return zero. The discrimination requirements are the control. Without them, "our tone was present" would be unfalsifiable — a metric that scored everything as tone would satisfy presence alone. **Fail-first:** with `frequency_share` forced to `return 1.0`, all six requirements fail and the test exits 1. Restored: ``` classifier: 440 tone -> 440 share 0.500, 880 share 0.000 classifier: 880 tone -> 880 share 0.500, 440 share 0.000 classifier: silence -> 440 share 0.000 classifier: white noise -> 440 share 0.000 PASS: 440 and 880 tones separated, silence and noise do not score as tone ``` Registered as `startup_audio_output_validation_classifier` and added to the `pr` test preset, so it gates pull requests; the endpoint arm keeps its capability skip: ``` 82 - startup_audio_output_validation (Skipped) 83 - startup_audio_output_validation_classifier ... Passed 0.02 sec ``` I also normalised the file: several blocks I inserted programmatically had a blank line after every line (766 → 670 lines), which would have been noise in review. **What this does not establish:** anything about the endpoint, the capture or the provider. It checks the classifier only, and the endpoint arm remains unexercised here until a host activates `VAD\Process_Loopback` — which is still the open question in my previous comment.
Author
Owner

@⁠triggered02 on GitHub · 2026-11-24 16:48 UTC · original

Updated in 4c55ae31. Mapping each point from your review to what is now in the fixture, and where I could not verify it.

Process-scoped capture instead of shared endpoint. process_loopback_client() activates VIRTUAL_AUDIO_DEVICE_PROCESS_LOOPBACK with AUDIOCLIENT_ACTIVATION_TYPE_PROCESS_LOOPBACK, TargetProcessId = GetCurrentProcessId() and PROCESS_LOOPBACK_MODE_INCLUDE_TARGET_PROCESS_TREE; the device client is released before activation, so the shared endpoint client is only used to read the mix format. There is no shared-endpoint capture path to fall back to.

Two distinguishable signals in the isolation control. A second process (self noise) plays 880 Hz through the real provider for the whole run while the fixture plays 440 Hz blocks; classification is by frequency share at 440 and 880, not by RMS, so an interfering client cannot be read as our tone, and a valid silence window cannot be broken by it.

Aggregate transitions only. The report is plan:, endpoint:, stream_latency:, phase transitions and timings; no samples are printed or stored.

Named capability skip, separate from assertion failures. Activation failure returns the named reason, which the skip line prints verbatim, and exits 77:

skip: process loopback capability unavailable (0x8000000e)
startup_audio_output_validation  ***Skipped   0.02 s (dev) / 0.05 s (release)
startup_audio_output_validation_classifier  Passed  0.02 s (dev) / 0.01 s (release)

Assertion failures still exit 1 (FAIL: ...), so a skip cannot be read as a pass.

Also fixed while in there: the header still described the shared-endpoint design and claimed the fixture reported shared; the isolation field started as "shared" and now starts as "unknown" and becomes "process" only after the scoped client activates. COM is now initialized MTA, matching the documented ApplicationLoopback sample pattern.

What I could not verify, and why. This host cannot activate process loopback: a minimal probe calling ActivateAudioInterfaceAsync with STA and MTA, targeting both the fixture's own pid and the shell's, in both loopback modes, returns 0x8000000E in all six combinations. So the switch to MTA is documented-pattern-correct but unverified here, and I am not claiming the arm works. Establishing that needs a host where process-scoped activation succeeds; on such a host the existing isolation control is what would falsify a wrongly shared capture.

AI-assisted (Claude Code).

**@⁠triggered02** on GitHub · 2026-11-24 16:48 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1536#issuecomment-7138243130) Updated in `4c55ae31`. Mapping each point from your review to what is now in the fixture, and where I could not verify it. **Process-scoped capture instead of shared endpoint.** `process_loopback_client()` activates `VIRTUAL_AUDIO_DEVICE_PROCESS_LOOPBACK` with `AUDIOCLIENT_ACTIVATION_TYPE_PROCESS_LOOPBACK`, `TargetProcessId = GetCurrentProcessId()` and `PROCESS_LOOPBACK_MODE_INCLUDE_TARGET_PROCESS_TREE`; the device client is released before activation, so the shared endpoint client is only used to read the mix format. There is no shared-endpoint capture path to fall back to. **Two distinguishable signals in the isolation control.** A second process (`self noise`) plays 880 Hz through the real provider for the whole run while the fixture plays 440 Hz blocks; classification is by frequency share at 440 and 880, not by RMS, so an interfering client cannot be read as our tone, and a valid silence window cannot be broken by it. **Aggregate transitions only.** The report is `plan:`, `endpoint:`, `stream_latency:`, phase transitions and timings; no samples are printed or stored. **Named capability skip, separate from assertion failures.** Activation failure returns the named reason, which the skip line prints verbatim, and exits 77: ``` skip: process loopback capability unavailable (0x8000000e) startup_audio_output_validation ***Skipped 0.02 s (dev) / 0.05 s (release) startup_audio_output_validation_classifier Passed 0.02 s (dev) / 0.01 s (release) ``` Assertion failures still exit 1 (`FAIL: ...`), so a skip cannot be read as a pass. Also fixed while in there: the header still described the shared-endpoint design and claimed the fixture reported `shared`; the isolation field started as `"shared"` and now starts as `"unknown"` and becomes `"process"` only after the scoped client activates. COM is now initialized MTA, matching the documented ApplicationLoopback sample pattern. **What I could not verify, and why.** This host cannot activate process loopback: a minimal probe calling `ActivateAudioInterfaceAsync` with STA and MTA, targeting both the fixture's own pid and the shell's, in both loopback modes, returns `0x8000000E` in all six combinations. So the switch to MTA is documented-pattern-correct but unverified here, and I am not claiming the arm works. Establishing that needs a host where process-scoped activation succeeds; on such a host the existing isolation control is what would falsify a wrongly shared capture. AI-assisted (Claude Code).
Author
Owner

@⁠triggered02 on GitHub · 2026-11-25 18:49 UTC · original

Rebased onto current main (b976e8bc) and force-pushed: head is 74c6904f (was 397efb64). Five commits replayed, none dropped or squashed; only the hashes changed and the messages are byte-identical. git diff --stat origin/main..HEAD is the PR's own three files (CMakeLists.txt +13, CMakePresets.json, tests/startup_audio_output_validation.cpp +741).

I also fixed the reason this PR's Windows job was red. The PR added startup_audio_output_validation_classifier to the pr test preset, but buildPresets[pr].targets is an explicit list and never got startup_audio_output_validation, so cmake --build --preset pr did not produce the fixture and ctest --preset pr failed with “Unable to find executable … startup_audio_output_validation”. This was true at 397efb64 as well, so it is not a rebase artifact. 74c6904f adds the target to buildPresets[pr].targets; I checked the preset parses, the classifier test name matches the pr include regex, startup_indirect_mesh_lease_warp_dual from main still matches, and the endpoint arm (startup_audio_output_validation) is still deliberately outside the pr gate.

Conflict: one, in CMakePresets.json. main had added startup_indirect_mesh_lease_warp_dual to the pr include alternation; I kept that and re-applied only this PR's startup_audio_output_validation_classifier. CMakeLists.txt merged cleanly; tests/startup_audio_output_validation.cpp was untouched by main and is byte-identical to the original head.

Verified on 74c6904f (out/pe-env Python, from the worktree): git diff --check clean; docs_links_check.py 19 files/469 links; bidi_controls_check.py 1738 files; startup_tools_lint_check.py 9 files parse. I also compiled the fixture translation unit with cl /W4 /c (exit 0, no warnings) and linked it with ole32 xaudio2 mmdevapi (exit 0), and ran the built classifier: audio.exe --self-test → exit 0 with PASS: 440 and 880 tones separated, silence and noise do not score as tone. That is not a CMake configure/build, so the real gates remain ctest --preset pr -R '^startup_audio_output_validation_classifier$' (device-free, must pass) and ctest --preset dev -R '^startup_audio_output_validation' (the endpoint arm may capability-skip 77, which is a skip, not a pass).

Deliberately unchanged: the endpoint/process-loopback arm still renders a real tone through the shared endpoint, so it stays out of the PR gate and remains capability-dependent; I have not measured it here. The commit subjects still carry the leading BOM they had before — I preserved the messages byte-for-byte rather than rewriting history.

This PR still carries CHANGES_REQUESTED from your earlier review of the capture design; the branch content is the same design with the CI gate repaired, so it needs a re-review rather than another code change from me unless you want the capture scope changed.

**@⁠triggered02** on GitHub · 2026-11-25 18:49 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1536#issuecomment-7171449325) Rebased onto current `main` (`b976e8bc`) and force-pushed: head is `74c6904f` (was `397efb64`). Five commits replayed, none dropped or squashed; only the hashes changed and the messages are byte-identical. `git diff --stat origin/main..HEAD` is the PR's own three files (`CMakeLists.txt` +13, `CMakePresets.json`, `tests/startup_audio_output_validation.cpp` +741). **I also fixed the reason this PR's Windows job was red.** The PR added `startup_audio_output_validation_classifier` to the `pr` **test** preset, but `buildPresets[pr].targets` is an explicit list and never got `startup_audio_output_validation`, so `cmake --build --preset pr` did not produce the fixture and `ctest --preset pr` failed with “Unable to find executable … startup_audio_output_validation”. This was true at `397efb64` as well, so it is not a rebase artifact. `74c6904f` adds the target to `buildPresets[pr].targets`; I checked the preset parses, the classifier test name matches the `pr` include regex, `startup_indirect_mesh_lease_warp_dual` from `main` still matches, and the endpoint arm (`startup_audio_output_validation`) is still deliberately outside the `pr` gate. **Conflict:** one, in `CMakePresets.json`. `main` had added `startup_indirect_mesh_lease_warp_dual` to the `pr` include alternation; I kept that and re-applied only this PR's `startup_audio_output_validation_classifier`. `CMakeLists.txt` merged cleanly; `tests/startup_audio_output_validation.cpp` was untouched by `main` and is byte-identical to the original head. **Verified on `74c6904f`** (`out/pe-env` Python, from the worktree): `git diff --check` clean; `docs_links_check.py` 19 files/469 links; `bidi_controls_check.py` 1738 files; `startup_tools_lint_check.py` 9 files parse. I also compiled the fixture translation unit with `cl /W4 /c` (exit 0, no warnings) and linked it with `ole32 xaudio2 mmdevapi` (exit 0), and ran the built classifier: `audio.exe --self-test` → exit 0 with `PASS: 440 and 880 tones separated, silence and noise do not score as tone`. That is not a CMake configure/build, so the real gates remain `ctest --preset pr -R '^startup_audio_output_validation_classifier$'` (device-free, must pass) and `ctest --preset dev -R '^startup_audio_output_validation'` (the endpoint arm may capability-skip 77, which is a skip, not a pass). **Deliberately unchanged:** the endpoint/process-loopback arm still renders a real tone through the shared endpoint, so it stays out of the PR gate and remains capability-dependent; I have not measured it here. The commit subjects still carry the leading BOM they had before — I preserved the messages byte-for-byte rather than rewriting history. This PR still carries `CHANGES_REQUESTED` from your earlier review of the capture design; the branch content is the same design with the CI gate repaired, so it needs a re-review rather than another code change from me unless you want the capture scope changed.
Author
Owner

@⁠triggered02 on GitHub · 2026-11-26 03:30 UTC · original

Rebased onto current main (e46d336c); head is now e823386 (was ␀e076002). Replay was clean � no manual conflict resolution this time � and no conflict markers.

Verified on e823386: ests/startup_run_ps1_check.py exit 0; CMakePresets.json parses, startup_audio_output_validation is in uildPresets[pr].targets, and the pr include regex matches startup_audio_output_validation_classifier; docs_links_check 523 links; idi_controls_check 1973 files; startup_tools_lint_check 11 files; git diff --check clean. The fixture ( ests/startup_audio_output_validation.cpp, 741 lines) and all eight CMake registrations survived, and main's 116 added CMakeLists.txt lines are intact.

This clears the rebase requirement; the branch still carries the older CHANGES_REQUESTED for the capture design, so it needs a re-review rather than another code change.

**@⁠triggered02** on GitHub · 2026-11-26 03:30 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1536#issuecomment-7181783266) Rebased onto current main (e46d336c); head is now e823386 (was ␀e076002). Replay was clean � no manual conflict resolution this time � and no conflict markers. Verified on e823386: ests/startup_run_ps1_check.py exit 0; CMakePresets.json parses, startup_audio_output_validation is in uildPresets[pr].targets, and the pr include regex matches startup_audio_output_validation_classifier; docs_links_check 523 links; idi_controls_check 1973 files; startup_tools_lint_check 11 files; git diff --check clean. The fixture ( ests/startup_audio_output_validation.cpp, 741 lines) and all eight CMake registrations survived, and main's 116 added CMakeLists.txt lines are intact. This clears the rebase requirement; the branch still carries the older CHANGES_REQUESTED for the capture design, so it needs a re-review rather than another code change.
Author
Owner

@⁠triggered02 on GitHub · 2026-11-26 03:32 UTC · original

Resolving both Codex findings from the review of 94830fbb, and @⁠R0Y00's change request. Current head e823386.

P2 � "Rebase the timing clock after the calibration probe": fixed in 98ac7d6a. ests/startup_audio_output_validation.cpp:553-554 now does exactly what the review asked:
cpp capture.begin_frames = capture.appended; begin = now_ms(); // the capture windows were rebased above, so the plan must be scheduled
so the phase loops schedule against the rebased clock rather than the pre-probe egin, and a slow endpoint probe no longer expires the deadlines. The pre-fix egin at line 489 is the calibration clock only.

P2 � "Validate the loopback sample encoding before decoding": fixed in 98ac7d6a. Lines 227-245 now classify the mix format instead of trusting wBitsPerSample == 32: WAVE_FORMAT_IEEE_FLOAT with 32 bits, or WAVE_FORMAT_EXTENSIBLE whose SubFormat GUID is loat with 32 bits, sets loat32; plain PCM or the PCM subformat with 16 bits sets pcm16; everything else takes the explicit refusal path
cpp std::snprintf(why, sizeof(why), "unsupported mix format tag=%u bits=%u", format->wFormatTag, format->wBitsPerSample);
so 8/24-bit PCM and 32-bit PCM are skipped with a reason instead of being decoded as float or read past the packet.

@⁠R0Y00's change request (shared endpoint loopback -> process-scoped capture): implemented in c592302f (process_loopback_client, capture scoped to the source-built playback process) and described in the head commit e823386.

Both Codex threads are therefore addressed by code, not by argument; the remaining blocker on this PR is a re-review to clear CHANGES_REQUESTED. Verified on e823386: startup_run_ps1_check exit 0, preset target/regex proof, docs 523 links, bidi 1973 files, lint 11 files.

**@⁠triggered02** on GitHub · 2026-11-26 03:32 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1536#issuecomment-7181802041) Resolving both Codex findings from the review of 94830fbb, and @⁠R0Y00's change request. Current head e823386. **P2 � "Rebase the timing clock after the calibration probe": fixed in 98ac7d6a.** ests/startup_audio_output_validation.cpp:553-554 now does exactly what the review asked: `cpp capture.begin_frames = capture.appended; begin = now_ms(); // the capture windows were rebased above, so the plan must be scheduled ` so the phase loops schedule against the rebased clock rather than the pre-probe egin, and a slow endpoint probe no longer expires the deadlines. The pre-fix egin at line 489 is the calibration clock only. **P2 � "Validate the loopback sample encoding before decoding": fixed in 98ac7d6a.** Lines 227-245 now classify the mix format instead of trusting wBitsPerSample == 32: WAVE_FORMAT_IEEE_FLOAT with 32 bits, or WAVE_FORMAT_EXTENSIBLE whose SubFormat GUID is loat with 32 bits, sets loat32; plain PCM or the PCM subformat with 16 bits sets pcm16; everything else takes the explicit refusal path `cpp std::snprintf(why, sizeof(why), "unsupported mix format tag=%u bits=%u", format->wFormatTag, format->wBitsPerSample); ` so 8/24-bit PCM and 32-bit PCM are skipped with a reason instead of being decoded as float or read past the packet. **@⁠R0Y00's change request (shared endpoint loopback -> process-scoped capture): implemented in c592302f** (process_loopback_client, capture scoped to the source-built playback process) and described in the head commit e823386. Both Codex threads are therefore addressed by code, not by argument; the remaining blocker on this PR is a re-review to clear CHANGES_REQUESTED. Verified on e823386: startup_run_ps1_check exit 0, preset target/regex proof, docs 523 links, bidi 1973 files, lint 11 files.
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-24 13:50 UTC · original · reviewed

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 94830fbb9f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@⁠codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@⁠codex address that feedback".

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-24 13:50 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1536#pullrequestreview-6040376862) · **reviewed** <!-- codex-review-receipt:v1 --> ### 💡 Codex Review Here are some automated review suggestions for this pull request. **Reviewed commit:** `94830fbb9f` <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@⁠codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@⁠codex address that feedback". </details>
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-24 14:11 UTC · original · requested changes

Please switch this fixture from shared endpoint loopback to capture scoped to the source-built playback process, as discussed in #1145. This version classifies endpoint windows by RMS, so another client can supply the apparent tone or turn a valid silence window into a failure. Keep the real XAudio2 provider, use two distinguishable signals in the isolation control, and report only aggregate transitions. If process-scoped activation is unavailable, use the named capability skip. Keep an assertion failure separate from capability skips.

**@⁠R0Y00** on GitHub · 2026-11-24 14:11 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1536#pullrequestreview-6040741550) · **requested changes** Please switch this fixture from shared endpoint loopback to capture scoped to the source-built playback process, as discussed in #1145. This version classifies endpoint windows by RMS, so another client can supply the apparent tone or turn a valid silence window into a failure. Keep the real XAudio2 provider, use two distinguishable signals in the isolation control, and report only aggregate transitions. If process-scoped activation is unavailable, use the named capability skip. Keep an assertion failure separate from capability skips.
Author
Owner

@⁠triggered02 on GitHub · 2026-12-01 18:16 UTC · original

Restored mergeability after main moved: merged origin/main (158ef794) into audio/output-validation, head is ad9f6470.

The only conflict was CMakePresets.json, and both hunks were unions:

  • buildPresets.pr.targets: main's 40 targets plus startup_audio_output_validation (41, no duplicates);
  • testPresets.pr filter: main's regex plus the startup_audio_output_validation_classifier arm. The endpoint arm stays out of the smoke preset as before, since it skips (77) without a loopback endpoint.

Verified on this head: the file parses as JSON, the target list is a superset of main's and of the previous head's, the filter is main's regex plus exactly that one arm, and tests/bidi_controls_check.py and tests/docs_links_check.py pass. No Windows evidence is claimed from this Linux host — the fixture itself still needs a Windows run with WASAPI loopback.

**@⁠triggered02** on GitHub · 2026-12-01 18:16 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1536#issuecomment-7320675408) Restored mergeability after main moved: merged `origin/main` (`158ef794`) into `audio/output-validation`, head is `ad9f6470`. The only conflict was `CMakePresets.json`, and both hunks were unions: - `buildPresets.pr.targets`: main's 40 targets plus `startup_audio_output_validation` (41, no duplicates); - `testPresets.pr` filter: main's regex plus the `startup_audio_output_validation_classifier` arm. The endpoint arm stays out of the smoke preset as before, since it skips (77) without a loopback endpoint. Verified on this head: the file parses as JSON, the target list is a superset of main's and of the previous head's, the filter is main's regex plus exactly that one arm, and `tests/bidi_controls_check.py` and `tests/docs_links_check.py` pass. No Windows evidence is claimed from this Linux host — the fixture itself still needs a Windows run with WASAPI loopback.
Author
Owner

@⁠triggered02 on GitHub · 2026-12-02 15:56 UTC · original

The Windows job failed, but not on this PR's change: the only failing test is startup_indirect_mesh_cache_heap_warp, which is the flake tracked in #3824 — ValueError: not enough values to unpack (expected 1, got 0) at tests/startup_indirect_mesh_cache_check.py:205, with the shim log showing the mesh request still pending when the fixture reached the glob().

It is the same failure I just recorded on #3824, from this run. Nothing in this PR touches request publication, the mesh cache, or that fixture — this PR adds the XAudio2 output-validation check and its classifier arm.

Re-running the job; the audio validation itself is unaffected either way.

**@⁠triggered02** on GitHub · 2026-12-02 15:56 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1536#issuecomment-7351197557) The Windows job failed, but not on this PR's change: the only failing test is `startup_indirect_mesh_cache_heap_warp`, which is the flake tracked in #3824 — `ValueError: not enough values to unpack (expected 1, got 0)` at `tests/startup_indirect_mesh_cache_check.py:205`, with the shim log showing the mesh request still `pending` when the fixture reached the `glob()`. It is the same failure I just recorded on #3824, from this run. Nothing in this PR touches request publication, the mesh cache, or that fixture — this PR adds the XAudio2 output-validation check and its classifier arm. Re-running the job; the audio validation itself is unaffected either way.
The isolation control launched the 880 Hz interferer from the captured process,
while the loopback capture uses PROCESS_LOOPBACK_MODE_INCLUDE_TARGET_PROCESS_TREE,
which by its documented meaning includes the target and its child processes. The
interferer was therefore inside the scope; the gap assertion only passed because
the capture was activated before the child existed, so the control did not test
isolation.

Run the playing and capturing arm in a dedicated child process and launch the
interferer from the fixture instead. The two are siblings, so no activation-time
snapshot can put the interferer inside the captured tree. The interferer signals
that its voice accepted audio before the capture arm starts and is checked alive
when it ends, so the gap assertion proves that a live 880 Hz render on the
endpoint does not reach a capture scoped to the sibling tree. The captured 440 Hz
tone and the plan assertions are unchanged, and the named capability skip (77) is
propagated from the child.

Refs #1145
Author
Owner

@⁠triggered02 on GitHub · 2026-12-03 15:34 UTC · original

@⁠R0Y00 Point-by-point against your review, plus one real flaw your isolation comment let me find.

Your six asks, against the current head:

Ask Status
Capture scoped to the source-built playback process instead of shared endpoint loopback done — TargetProcessId=GetCurrentProcessId(), INCLUDE_TARGET_PROCESS_TREE, shared client released after GetMixFormat
Keep the real XAudio2 provider done — XAudio2Create, no import patching
Two distinguishable signals in the isolation control was wrong — fixed below
Report only aggregate transitions done — plan:/windows/floor/peak/threshold, no samples
Named capability skip if process-scoped activation is unavailable done — skip 77 with a named reason
Keep assertion failures separate from skips done — FAIL returns 1, skip returns 77

The isolation control was not testing isolation. The interferer was CreateProcessW'd by the captured process (startup_audio_output_validation.cpp:458), while the capture uses PROCESS_LOOPBACK_MODE_INCLUDE_TARGET_PROCESS_TREE — documented as including the target and its child processes. So the 880 Hz tone was inside the scope, and the gap_level > 0.01 assertion could only ever pass because the capture happened to be armed before the child existed. That is activation-snapshot behaviour, not contract.

Fixed in 824df514: the playing/capturing arm now runs in a dedicated child process and the fixture launches the interferer, making them siblings — outside the documented target tree at every instant, so the result no longer depends on when membership is snapshotted. The interferer signals that its voice accepted audio before the capture arms and is checked alive when it ends, and it renders 100 ms whole-cycle buffers so it cannot underrun during the gap (the old 10 ms buffer plus Sleep could have left it silent inside the gap — which would have let the gap check pass for the wrong reason).

What the gap assertion now proves: a live, fixture-started 880 Hz render on the same endpoint did not reach a capture scoped to the sibling tree. It does not prove the capture is unscoped-capable or that the interferer's audio was audible; an unscoped endpoint capture would be needed to measure that, and it is not in this PR.

Also merged current main in 0f83f29d, resolving CMakePresets.json by taking main's file and re-appending this branch's build target and classifier arm (regex verified compiling, parens balanced).

Still needs your side: 0x8000000E on every activation attempt here, i.e. process loopback does not activate on this host, so the fixture takes its named skip. One run on a Windows 11 machine where VAD\Process_Loopback activates would settle it — after that, if you are content with the named skip for hosts without it, this is ready.

Also worth correcting: an earlier comment of mine claimed classification is by frequency share rather than RMS. The plan windows are still RMS-classified; frequency share only attributes the isolation gap and tone. Your RMS sentence was answered by the scoping, and the description should have said so.

Build: cmake --build out/build/clang --target startup_audio_output_validation -j 8 links with clang-cl 19 + xwin (not run — no process loopback here).

**@⁠triggered02** on GitHub · 2026-12-03 15:34 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1536#issuecomment-7383380579) @⁠R0Y00 Point-by-point against your review, plus one real flaw your isolation comment let me find. **Your six asks, against the current head:** | Ask | Status | |---|---| | Capture scoped to the source-built playback process instead of shared endpoint loopback | done — `TargetProcessId=GetCurrentProcessId()`, `INCLUDE_TARGET_PROCESS_TREE`, shared client released after `GetMixFormat` | | Keep the real XAudio2 provider | done — `XAudio2Create`, no import patching | | Two distinguishable signals in the isolation control | **was wrong — fixed below** | | Report only aggregate transitions | done — `plan:`/`windows`/`floor`/`peak`/`threshold`, no samples | | Named capability skip if process-scoped activation is unavailable | done — skip 77 with a named reason | | Keep assertion failures separate from skips | done — FAIL returns 1, skip returns 77 | **The isolation control was not testing isolation.** The interferer was `CreateProcessW`'d *by the captured process* (`startup_audio_output_validation.cpp:458`), while the capture uses `PROCESS_LOOPBACK_MODE_INCLUDE_TARGET_PROCESS_TREE` — documented as including the target **and its child processes**. So the 880 Hz tone was inside the scope, and the `gap_level > 0.01` assertion could only ever pass because the capture happened to be armed before the child existed. That is activation-snapshot behaviour, not contract. Fixed in `824df514`: the playing/capturing arm now runs in a dedicated child process and the fixture launches the interferer, making them **siblings** — outside the documented target tree at every instant, so the result no longer depends on when membership is snapshotted. The interferer signals that its voice accepted audio before the capture arms and is checked alive when it ends, and it renders 100 ms whole-cycle buffers so it cannot underrun during the gap (the old 10 ms buffer plus `Sleep` could have left it silent inside the gap — which would have let the gap check pass for the wrong reason). What the gap assertion now proves: *a live, fixture-started 880 Hz render on the same endpoint did not reach a capture scoped to the sibling tree.* It does not prove the capture is unscoped-capable or that the interferer's audio was audible; an unscoped endpoint capture would be needed to measure that, and it is not in this PR. Also merged current `main` in `0f83f29d`, resolving `CMakePresets.json` by taking main's file and re-appending this branch's build target and classifier arm (regex verified compiling, parens balanced). **Still needs your side:** `0x8000000E` on every activation attempt here, i.e. process loopback does not activate on this host, so the fixture takes its named skip. One run on a Windows 11 machine where `VAD\Process_Loopback` activates would settle it — after that, if you are content with the named skip for hosts without it, this is ready. Also worth correcting: an earlier comment of mine claimed classification is by frequency share rather than RMS. The plan windows are still RMS-classified; frequency share only attributes the isolation gap and tone. Your RMS sentence was answered by the scoping, and the description should have said so. Build: `cmake --build out/build/clang --target startup_audio_output_validation -j 8` links with clang-cl 19 + xwin (not run — no process loopback here).
Author
Owner

@⁠R0Y00 on GitHub · 2026-12-03 16:01 UTC · original · requested changes

I built and ran both startup_audio_output_validation CTests at 824df514 (MSVC Debug, Windows 11 build 26300). The classifier passed all four synthetic inputs. The process-capture test returned 77: ActivateAudioInterfaceAsync returned 0x8000000e before capture, even though this head initializes MTA.

The callback currently exposes IUnknown and IActivateAudioInterfaceCompletionHandler only. A local control changing it to a WRL RuntimeClass with FtmBase and constructing it with WRL Make got past the exact activation error on the same machine and opened a process-scoped 44.1 kHz, eight-channel stream. The real-provider fixture then failed separately because the probe tone was not observed within four seconds. The agile callback looks like the right first fix, but I still need a passing end-to-end isolation run on the resulting head. Please keep the activation HRESULT diagnostic distinct from a missing endpoint and record a run with playback, the classified gap, and both sibling-interference checks.

Reference: https://learn.microsoft.com/en-us/windows/win32/api/mmdeviceapi/nf-mmdeviceapi-activateaudiointerfaceasync

**@⁠R0Y00** on GitHub · 2026-12-03 16:01 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1536#pullrequestreview-6173448145) · **requested changes** I built and ran both startup_audio_output_validation CTests at 824df514 (MSVC Debug, Windows 11 build 26300). The classifier passed all four synthetic inputs. The process-capture test returned 77: ActivateAudioInterfaceAsync returned 0x8000000e before capture, even though this head initializes MTA. The callback currently exposes IUnknown and IActivateAudioInterfaceCompletionHandler only. A local control changing it to a WRL RuntimeClass with FtmBase and constructing it with WRL Make got past the exact activation error on the same machine and opened a process-scoped 44.1 kHz, eight-channel stream. The real-provider fixture then failed separately because the probe tone was not observed within four seconds. The agile callback looks like the right first fix, but I still need a passing end-to-end isolation run on the resulting head. Please keep the activation HRESULT diagnostic distinct from a missing endpoint and record a run with playback, the classified gap, and both sibling-interference checks. Reference: https://learn.microsoft.com/en-us/windows/win32/api/mmdeviceapi/nf-mmdeviceapi-activateaudiointerfaceasync
Author
Owner

@⁠triggered02 on GitHub · 2026-12-03 16:12 UTC · original

Fixed in 58ca9af0, following your local control exactly.

What was wrong. ActivateAudioInterfaceAsync marshals the completion callback into another apartment, so the handler has to be agile. The old handler was a classic-COM object exposing only IUnknown and IActivateAudioInterfaceCompletionHandler, with no free-threaded marshaler — hence 0x8000000E before any capture existed, MTA notwithstanding.

The handler now answers IID_IMarshal from a CoCreateFreeThreadedMarshaler — the same thing WRL's FtmBase installs — and keeps its own reference counting, so the call sites do not change shape.

One deviation from your control worth explaining: I did not use Microsoft::WRL::RuntimeClass<..., FtmBase> because the xwin SDK splat's <wrl/implements.h> includes a WinString.h it does not ship, so WRL would make the documented clang-cl cross-compile unable to build this fixture at all (verified — that is the error I got first). The hand-rolled marshaler is the same mechanism with no new header or link dependency.

Diagnostics are now distinct, as you asked — an activation rejection can no longer read as a missing endpoint:

Path Message
ActivateAudioInterfaceAsync rejected process loopback activation call failed (0x…)
callback never ran within 5 s process loopback activation did not complete within 5 s (last 0x…)
activation succeeded, result failed process loopback activation result failed (0x…)
no interface after success process loopback interface unavailable after activation (0x…)
QueryInterface for the client failed process loopback client query failed after activation

— all still reported through the named capability skip (77), not as assertion failures.

Verified: cmake --build out/build/clang --target startup_audio_output_validation -j 8 links with clang-cl 19 + xwin. Not verified: the end-to-end isolation run you asked for — this host has no process-loopback activation at all, so it takes the skip and cannot exercise the new path. That run on 58ca9af0 is the one I need from you, and I would rather say so than imply the build proves anything about activation.

You also noted the real-provider fixture then failed because the probe tone was not observed within four seconds. I have not touched that: if activation now succeeds on your machine, the probe-tone timing is the next thing to look at, and I would want your run's plan/transition output before changing any timing constant — guessing at it would be exactly the kind of change that makes a fixture pass for the wrong reason.

**@⁠triggered02** on GitHub · 2026-12-03 16:12 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1536#issuecomment-7384443651) Fixed in `58ca9af0`, following your local control exactly. **What was wrong.** `ActivateAudioInterfaceAsync` marshals the completion callback into another apartment, so the handler has to be agile. The old handler was a classic-COM object exposing only `IUnknown` and `IActivateAudioInterfaceCompletionHandler`, with no free-threaded marshaler — hence `0x8000000E` before any capture existed, MTA notwithstanding. **The handler now answers `IID_IMarshal` from a `CoCreateFreeThreadedMarshaler`** — the same thing WRL's `FtmBase` installs — and keeps its own reference counting, so the call sites do not change shape. One deviation from your control worth explaining: I did **not** use `Microsoft::WRL::RuntimeClass<..., FtmBase>` because the xwin SDK splat's `<wrl/implements.h>` includes a `WinString.h` it does not ship, so WRL would make the documented clang-cl cross-compile unable to build this fixture at all (verified — that is the error I got first). The hand-rolled marshaler is the same mechanism with no new header or link dependency. **Diagnostics are now distinct**, as you asked — an activation rejection can no longer read as a missing endpoint: | Path | Message | |---|---| | `ActivateAudioInterfaceAsync` rejected | `process loopback activation call failed (0x…)` | | callback never ran within 5 s | `process loopback activation did not complete within 5 s (last 0x…)` | | activation succeeded, result failed | `process loopback activation result failed (0x…)` | | no interface after success | `process loopback interface unavailable after activation (0x…)` | | `QueryInterface` for the client failed | `process loopback client query failed after activation` | — all still reported through the named capability skip (77), not as assertion failures. **Verified:** `cmake --build out/build/clang --target startup_audio_output_validation -j 8` links with clang-cl 19 + xwin. **Not verified:** the end-to-end isolation run you asked for — this host has no process-loopback activation at all, so it takes the skip and cannot exercise the new path. That run on `58ca9af0` is the one I need from you, and I would rather say so than imply the build proves anything about activation. You also noted the real-provider fixture then failed because the probe tone was not observed within four seconds. I have not touched that: if activation now succeeds on your machine, the probe-tone timing is the next thing to look at, and I would want your run's plan/transition output before changing any timing constant — guessing at it would be exactly the kind of change that makes a fixture pass for the wrong reason.
R0Y00 built and ran both CTests at 824df514 with MSVC Debug on Windows 11 26300:
the classifier passed all four synthetic inputs, but the process-capture test
returned 77 because ActivateAudioInterfaceAsync returned 0x8000000E before any
capture existed, even with MTA initialised. A local control using an agile
handler got past that error on the same machine.

The completion callback is marshalled into another apartment, so the handler must
be agile. It now answers IID_IMarshal from a CoCreateFreeThreadedMarshaler, which
is what WRL's FtmBase installs; hand-rolled because the xwin SDK splat's
<wrl/implements.h> includes a WinString.h it does not ship, which would make the
documented clang-cl route unable to build this fixture at all.

Activation failures are also reported distinctly now: the activation call's own
HRESULT, a five-second timeout on the callback, and a missing interface after a
successful activation each get their own message, so an activation rejection can
no longer look like a missing endpoint.

Verified by building the target with clang-cl/xwin. NOT run: this host has no
process-loopback activation, so the end-to-end isolation run R0Y00 asked for is
still his to make on the new head.
# Conflicts:
#	CMakePresets.json
Author
Owner

@⁠triggered02 on GitHub · 2026-12-03 16:16 UTC · original

Two things in this comment: the fix is unchanged, and the branch was silently un-CI-able for a while.

Why 58ca9af0 had no CI run. The branch had gone CONFLICTING, and a conflicted PR never gets a pull_request run — GitHub cannot build the merge ref. Nothing was wrong with the change; the job simply never existed. Merging main (8814402b) produced one conflict, in CMakePresets.json, resolved by taking main's file and re-appending this branch's build target and classifier arm (regex verified compiling, 31/31 parens).

So the agile-handler change from the previous comment is now on a head that can actually be tested.

What I need from you, on 8814402b: the end-to-end isolation run. This host has no process-loopback activation at all, so it takes the skip and cannot exercise the new path — the build is the only thing I can verify. If activation now succeeds, the probe-tone not-observed-within-four-seconds failure you saw is the next thing, and I would want that run's plan and transition output before touching any timing constant.

**@⁠triggered02** on GitHub · 2026-12-03 16:16 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1536#issuecomment-7384560130) Two things in this comment: the fix is unchanged, and the branch was silently un-CI-able for a while. **Why `58ca9af0` had no CI run.** The branch had gone `CONFLICTING`, and a conflicted PR never gets a `pull_request` run — GitHub cannot build the merge ref. Nothing was wrong with the change; the job simply never existed. Merging `main` (`8814402b`) produced one conflict, in `CMakePresets.json`, resolved by taking main's file and re-appending this branch's build target and classifier arm (regex verified compiling, 31/31 parens). So the agile-handler change from the previous comment is now on a head that can actually be tested. **What I need from you, on `8814402b`:** the end-to-end isolation run. This host has no process-loopback activation at all, so it takes the skip and cannot exercise the new path — the build is the only thing I can verify. If activation now succeeds, the probe-tone not-observed-within-four-seconds failure you saw is the next thing, and I would want that run's plan and transition output before touching any timing constant.
Author
Owner

@⁠R0Y00 on GitHub · 2026-12-03 16:20 UTC · original

Independent retest on 8814402b: MSVC Debug, Windows 11 build 26300. The device-free classifier passed. The capture still skipped with 77 because ActivateAudioInterfaceAsync returned 0x8000000E before activation. This head delegates IMarshal, but its QueryInterface still returns E_NOINTERFACE for IAgileObject.

In the same source and environment, I only added an explicit IAgileObject interface to the callback and returned it from QueryInterface. Activation then opened a process-scoped 44.1 kHz, eight-channel stream. The capture still failed at the next stage with “endpoint never delivered the probe tone within 4 s”. This isolates two separate steps: fix the callback agility contract on the checked-in head, then verify the provider tone and sibling control with an actual capture.

**@⁠R0Y00** on GitHub · 2026-12-03 16:20 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1536#issuecomment-7384663341) Independent retest on 8814402b: MSVC Debug, Windows 11 build 26300. The device-free classifier passed. The capture still skipped with 77 because ActivateAudioInterfaceAsync returned 0x8000000E before activation. This head delegates IMarshal, but its QueryInterface still returns E_NOINTERFACE for IAgileObject. In the same source and environment, I only added an explicit IAgileObject interface to the callback and returned it from QueryInterface. Activation then opened a process-scoped 44.1 kHz, eight-channel stream. The capture still failed at the next stage with “endpoint never delivered the probe tone within 4 s”. This isolates two separate steps: fix the callback agility contract on the checked-in head, then verify the provider tone and sibling control with an actual capture.
Author
Owner

@⁠triggered02 on GitHub · 2026-12-03 16:25 UTC · original

@⁠R0Y00 Added in c0e7291e — and your phrasing is the whole fix: agility is two things, not one.

The handler delegated IMarshal but still answered E_NOINTERFACE for IAgileObject. It now derives from IAgileObject and returns itself for that IID; the marker interface has no methods, so answering it is the contract. objidl.h supplies the declaration. Nothing else changed — the marshaler, the distinct activation diagnostics and the interferer scope all stay as they were on 8814402b.

I kept the hand-rolled marshaler rather than switching to WRL FtmBase for the reason in the previous comment: the xwin splat's <wrl/implements.h> includes a WinString.h it does not ship, so WRL would make the documented clang-cl route unable to build this fixture at all. With both halves now explicit, the object should satisfy actiation the same way your control did.

Your two-step isolation is now the roadmap on this PR:

  1. callback agility — fixed here; needs your retest to confirm activation opens a stream;
  2. provider tone — the endpoint never delivered the probe tone within 4 s failure you saw after activation succeeded.

I have deliberately not touched (2). With activation working, that failure is the first real observation of the provider path this fixture has ever had, and the timing constants are the wrong thing to guess at without it: if the plan/transition output from a working activation shows the tone arriving late rather than not at all, the fix is a deadline; if it never arrives, the deadline is not the bug. Send that run's output and I will treat it as the specification rather than inventing a threshold.

Also for the record on this branch: 58ca9af0 had no CI run at all because the branch was CONFLICTING, and a conflicted PR never gets a pull_request run — GitHub cannot build the merge ref. 8814402b merged main and the run started; c0e7291e builds clean with clang-cl.

**@⁠triggered02** on GitHub · 2026-12-03 16:25 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1536#issuecomment-7384821212) @⁠R0Y00 Added in `c0e7291e` — and your phrasing is the whole fix: **agility is two things, not one.** The handler delegated `IMarshal` but still answered `E_NOINTERFACE` for `IAgileObject`. It now derives from `IAgileObject` and returns itself for that IID; the marker interface has no methods, so answering it *is* the contract. `objidl.h` supplies the declaration. Nothing else changed — the marshaler, the distinct activation diagnostics and the interferer scope all stay as they were on `8814402b`. I kept the hand-rolled marshaler rather than switching to WRL `FtmBase` for the reason in the previous comment: the xwin splat's `<wrl/implements.h>` includes a `WinString.h` it does not ship, so WRL would make the documented clang-cl route unable to build this fixture at all. With both halves now explicit, the object should satisfy actiation the same way your control did. Your two-step isolation is now the roadmap on this PR: 1. **callback agility** — fixed here; needs your retest to confirm activation opens a stream; 2. **provider tone** — the `endpoint never delivered the probe tone within 4 s` failure you saw after activation succeeded. I have deliberately not touched (2). With activation working, that failure is the first real observation of the provider path this fixture has ever had, and the timing constants are the wrong thing to guess at without it: if the plan/transition output from a working activation shows the tone arriving late rather than not at all, the fix is a deadline; if it never arrives, the deadline is not the bug. Send that run's output and I will treat it as the specification rather than inventing a threshold. Also for the record on this branch: `58ca9af0` had no CI run at all because the branch was `CONFLICTING`, and a conflicted PR never gets a `pull_request` run — GitHub cannot build the merge ref. `8814402b` merged `main` and the run started; `c0e7291e` builds clean with clang-cl.
R0Y00 retested 8814402b on Windows 11 26300 with MSVC Debug: the device-free
classifier passed, but the capture still skipped with 77 because
ActivateAudioInterfaceAsync returned 0x8000000E before activation. His finding is
precise: this head delegates IMarshal, but QueryInterface still returns
E_NOINTERFACE for IAgileObject. Adding only that interface to the callback, in the
same source and environment, opened a process-scoped 44.1 kHz eight-channel
stream.

Agility is therefore two things, not one: a free-threaded marshaler for IMarshal
and an affirmative answer to IAgileObject. The handler now derives from
IAgileObject and returns itself for that IID; the marker interface has no methods,
so that is the whole contract.

Verified by building the target with clang-cl/xwin. NOT run: this host has no
process-loopback activation, so the two things R0Y00 isolates remain his to
observe on this head - activation succeeding, and then the provider tone within
four seconds.
Author
Owner

@⁠R0Y00 on GitHub · 2026-12-03 16:40 UTC · original

Independent retest on c0e7291e (MSVC Debug, Windows 11 build 26300). The checked-in callback opened the process capture at 44.1 kHz, 8 channels, 32 bits. The classifier passed. The endpoint arm failed at the probe with no capability skip.

The probe did receive the tone. An aggregate-only diagnostic read 176,841 capture frames across 401 windows while XAudio2 played 172,800 samples. Peak on any channel was 0.097697, but the eight-channel arithmetic mean peaked at 0.024424 and the highest classified-window RMS was 0.017397, below the hard 0.02 probe threshold. The 440 Hz share reached 0.426328. As a second local control, touching only the probe threshold let it detect the tone at 60.5 ms. That run then failed at the later resume check: 30 ms per planned phase, onset 10.0 ms, silence index 200.0 ms, no recognized resumption. The local controls were reverted.

The activation fix is confirmed. For the fixture, please preserve the distinct 440/880 test and make probe and duration classification robust to channel dilution and window alignment. A synthetic multichannel case exercising the quiet/tone/resume classifier would make that behavior reproducible without an endpoint.

**@⁠R0Y00** on GitHub · 2026-12-03 16:40 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1536#issuecomment-7385252914) Independent retest on c0e7291e (MSVC Debug, Windows 11 build 26300). The checked-in callback opened the process capture at 44.1 kHz, 8 channels, 32 bits. The classifier passed. The endpoint arm failed at the probe with no capability skip. The probe did receive the tone. An aggregate-only diagnostic read 176,841 capture frames across 401 windows while XAudio2 played 172,800 samples. Peak on any channel was 0.097697, but the eight-channel arithmetic mean peaked at 0.024424 and the highest classified-window RMS was 0.017397, below the hard 0.02 probe threshold. The 440 Hz share reached 0.426328. As a second local control, touching only the probe threshold let it detect the tone at 60.5 ms. That run then failed at the later resume check: 30 ms per planned phase, onset 10.0 ms, silence index 200.0 ms, no recognized resumption. The local controls were reverted. The activation fix is confirmed. For the fixture, please preserve the distinct 440/880 test and make probe and duration classification robust to channel dilution and window alignment. A synthetic multichannel case exercising the quiet/tone/resume classifier would make that behavior reproducible without an endpoint.
Author
Owner

@⁠triggered02 on GitHub · 2026-12-03 17:14 UTC · original

Your diagnostic is the specification, so 16c7df97 implements it directly. Activation stays as it is; everything below is the classifier and the plan.

What your numbers said. The tone was there — 0.0977 on one channel, 440 Hz share 0.426 — but the fixture thresholded the eight-channel arithmetic mean, which divides a one-channel tone by eight (your mean peak 0.0244, window RMS 0.0174 against the hard 0.02). So the probe could not fire on a correct capture. Then the 30 ms phases: a quiet run that swallowed the resumption is what a phase shorter than the endpoint's packet granularity has to produce.

Three changes, all in tests/startup_audio_output_validation.cpp:

  1. Per-channel features. A window is measured on its loudest channel: RMS plus the 440 and 880 Hz Goertzel shares. The share is a ratio, so it survives channel dilution; the level gate only rejects numeric silence. The downmixed RMS is kept as mean_level and printed, so a run now shows the dilution instead of requiring a local instrumented control to find it.
  2. Overlapping windows. The grid hops half a window, so an onset between window starts is still measured, and a window that starts inside the tone classifies as the tone.
  3. Timeline + longer plan. Tone / gap / resumption are runs of consecutive classified windows, with minimum run lengths derived from the planned phase duration and the hop; the silence envelope allows one hop at each end. Each phase is now at least ten endpoint blocks, because 30 ms is shorter than the packet granularity your run showed.

The synthetic multichannel case you asked for is in --self-test (startup_audio_output_validation_classifier, no endpoint needed): an 8-channel window with the tone on one channel; the same window started 3 ms into the tone; an 880 Hz interferer on one channel; a full quiet/tone/gap/resume/tail plan built from classified windows; and three negative controls (no resumption, no tone, and a capture that only ever shows quiet). The distinct 440/880 test is preserved — an 880 interferer on one channel must classify as other, never as ours.

$ wine startup_audio_output_validation.exe --self-test        # exit 0
classifier: 8 ch, 440 on channel 3 -> level 0.0707 mean 0.0088 share440 0.500
classifier: 8 ch, 880 on channel 5 -> share440 0.000 share880 0.500
classifier: window starting 3 ms into the tone -> share440 0.484
classifier: synthetic plan -> tone 20, silence 44, resume 92 of 128 windows
PASS: ... multichannel dilution and window alignment classify, and the synthetic quiet/tone/resume plan is recovered
$ wine startup_audio_output_validation.exe                    # exit 77
skip: process loopback activation result failed (0x80070002)   # this host has no audio device

Mutation controls, both killed: restoring the old downmixed rule (mean_level >= 0.02) fails four assertions, including the 8-channel case and the 3 ms-offset window; reporting the first tone run as the resumption fails the plan check and the no-resumption control.

What this does not establish. Nothing about the real endpoint path: this host has no audio device, so the loopback arm skips here. Whether the plan is now resolvable against a real shared-mode stream on your machine is exactly the run you have been making, and the new windows=... peak_level=... peak_mean=... peak_share440=... line will say which side of the threshold it landed on if it fails again. X2W_AUDIO_VALIDATION_DEBUG=1 prints the per-window class.

**@⁠triggered02** on GitHub · 2026-12-03 17:14 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1536#issuecomment-7386181681) Your diagnostic is the specification, so `16c7df97` implements it directly. Activation stays as it is; everything below is the classifier and the plan. **What your numbers said.** The tone *was* there — 0.0977 on one channel, 440 Hz share 0.426 — but the fixture thresholded the eight-channel arithmetic mean, which divides a one-channel tone by eight (your mean peak 0.0244, window RMS 0.0174 against the hard 0.02). So the probe could not fire on a correct capture. Then the 30 ms phases: a quiet run that swallowed the resumption is what a phase shorter than the endpoint's packet granularity has to produce. **Three changes, all in `tests/startup_audio_output_validation.cpp`:** 1. **Per-channel features.** A window is measured on its **loudest channel**: RMS plus the 440 and 880 Hz Goertzel shares. The share is a ratio, so it survives channel dilution; the level gate only rejects numeric silence. The downmixed RMS is kept as `mean_level` and printed, so a run now shows the dilution instead of requiring a local instrumented control to find it. 2. **Overlapping windows.** The grid hops half a window, so an onset between window starts is still measured, and a window that starts inside the tone classifies as the tone. 3. **Timeline + longer plan.** Tone / gap / resumption are runs of consecutive classified windows, with minimum run lengths derived from the planned phase duration and the hop; the silence envelope allows one hop at each end. Each phase is now at least ten endpoint blocks, because 30 ms is shorter than the packet granularity your run showed. **The synthetic multichannel case you asked for** is in `--self-test` (`startup_audio_output_validation_classifier`, no endpoint needed): an 8-channel window with the tone on one channel; the same window started 3 ms into the tone; an 880 Hz interferer on one channel; a full quiet/tone/gap/resume/tail plan built from classified windows; and three negative controls (no resumption, no tone, and a capture that only ever shows quiet). The distinct 440/880 test is preserved — an 880 interferer on one channel must classify as *other*, never as ours. ``` $ wine startup_audio_output_validation.exe --self-test # exit 0 classifier: 8 ch, 440 on channel 3 -> level 0.0707 mean 0.0088 share440 0.500 classifier: 8 ch, 880 on channel 5 -> share440 0.000 share880 0.500 classifier: window starting 3 ms into the tone -> share440 0.484 classifier: synthetic plan -> tone 20, silence 44, resume 92 of 128 windows PASS: ... multichannel dilution and window alignment classify, and the synthetic quiet/tone/resume plan is recovered $ wine startup_audio_output_validation.exe # exit 77 skip: process loopback activation result failed (0x80070002) # this host has no audio device ``` Mutation controls, both killed: restoring the old downmixed rule (`mean_level >= 0.02`) fails four assertions, including the 8-channel case and the 3 ms-offset window; reporting the first tone run as the resumption fails the plan check *and* the no-resumption control. **What this does not establish.** Nothing about the real endpoint path: this host has no audio device, so the loopback arm skips here. Whether the plan is now resolvable against a real shared-mode stream on your machine is exactly the run you have been making, and the new `windows=... peak_level=... peak_mean=... peak_share440=...` line will say which side of the threshold it landed on if it fails again. `X2W_AUDIO_VALIDATION_DEBUG=1` prints the per-window class.
R0Y00's retest on c0e7291e showed the activation fix works: the process
capture opened at 44.1 kHz, 8 channels, 32 bits. The endpoint arm then failed
at the probe with no capability skip, and his diagnostic explains why: the
probe tone was captured (176,841 frames over 401 windows against 172,800
played samples) with a single-channel peak of 0.0977 and 440 Hz share of
0.426, but the eight-channel arithmetic mean peaked at 0.0244 and the highest
window RMS was 0.0174 - under the hard 0.02 probe threshold. A probe-only
local control detected the tone at 60.5 ms and then failed the next check
with 30 ms phases: one quiet run swallowed the resumption.

Three changes, all in the fixture:

- Per-channel features. A window is measured on its loudest channel: RMS and
  the 440/880 Hz Goertzel share. The band share is a ratio, so it does not
  dilute when only one of eight channels carries the tone, and the level gate
  only rejects numeric silence. The downmixed RMS is kept as `mean_level` and
  reported, so a run shows the dilution instead of leaving it to inference.
- Overlapping windows. The grid now hops half a window, so an onset that
  falls between window starts is still measured and a window that starts
  inside the tone classifies as the tone.
- A timeline analyser and a longer plan. Tone, gap and resumption are runs of
  consecutive classified windows whose minimum lengths come from the planned
  phase duration and the hop, not fixed window counts; the silence envelope
  allows one hop at each end. The plan sizes each phase to at least ten
  endpoint blocks, because a 30 ms phase is shorter than the packet
  granularity that the reporting host showed.

The synthetic case R0Y00 asked for is in the device-free self-test
(`--self-test`, registered as startup_audio_output_validation_classifier): an
eight-channel window with the tone on one channel, the same window started
3 ms into the tone, an 880 Hz interferer on one channel, a full
quiet/tone/gap/resume/tail plan built from classified windows, and three
negative controls (no resumption, no tone, and a capture that only ever shows
the quiet case). The distinct 440/880 test is preserved.

Refs #1536.

Verified on this host (Linux, clang-cl 19 xwin build, Wine + vkd3d-proton, no
audio endpoint):

  wine startup_audio_output_validation.exe --self-test      -> exit 0, PASS
    8 ch 440 on channel 3 -> level 0.0707 mean 0.0088 share440 0.500
    8 ch 880 on channel 5 -> share440 0.000 share880 0.500
    window starting 3 ms into the tone -> share440 0.484
    synthetic plan -> tone 20, silence 44, resume 92 of 128 windows
  wine startup_audio_output_validation.exe                  -> exit 77,
    "skip: process loopback activation result failed (0x80070002)" (no device)

Mutation controls (both killed): restoring the old downmixed rule
(`mean_level >= 0.02`) fails four assertions, and reporting the first tone run
as the resumption fails the plan check and the no-resumption control.

Not established here: any behaviour of the real endpoint path. This host has no
audio device, so tone/gap/resume against a real loopback stream is the Windows
run R0Y00 has been making, and remains his to confirm.
Author
Owner

@⁠R0Y00 on GitHub · 2026-12-03 17:21 UTC · original · reviewed

Independent MSVC Debug retest on 16c7df97, Windows 11 build 26300: the device-free classifier passed, including multichannel dilution, window alignment and the quiet/tone/resume negative controls. The real process capture returned failure after the parent's 60 s wait. The only endpoint-arm output was the sibling-process launch line, so this run does not establish where the child stalled. Please keep aggregate progress visible after activation, probe and each playback phase, and make diagnostic output flush across the subprocess boundary so a future timeout identifies its last completed stage.

**@⁠R0Y00** on GitHub · 2026-12-03 17:21 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1536#pullrequestreview-6174841390) · **reviewed** Independent MSVC Debug retest on 16c7df97, Windows 11 build 26300: the device-free classifier passed, including multichannel dilution, window alignment and the quiet/tone/resume negative controls. The real process capture returned failure after the parent's 60 s wait. The only endpoint-arm output was the sibling-process launch line, so this run does not establish where the child stalled. Please keep aggregate progress visible after activation, probe and each playback phase, and make diagnostic output flush across the subprocess boundary so a future timeout identifies its last completed stage.
R0Y00's MSVC Debug retest on 16c7df97 passed the device-free classifier,
including the multichannel, alignment and negative controls, but the real
process capture hit the harness's 60 s wait with only the sibling-launch line
in the log. The child could not say where it was: its stdout is a pipe into
the parent, and nothing in the arm was flushed.

Every stage the arm enters now prints a "progress:" line and flushes it, and
stdout is unbuffered so no line can be lost when the parent gives up. The
stages are: open, activate (before the loopback request and after the client
activates), capture (format, isolation and endpoint buffer), caller, plan
(blocks, withheld, resume), baseline (how long quiet took), probe (stream
latency), measure, every submitted tone block with the window count so far,
silence, withheld, every resumption block, tail, and collected (window and
frame totals).

The harness also prints its own heartbeat every 5 s while it waits, and its
timeout message now says the last flushed progress line names the stage the
child entered, because that is the only honest statement a parent can make
about a child that is still inside a call.

Refs #1536.

Verified on this host (clang-cl 19 xwin build, Wine + vkd3d-proton, no audio
device - so the endpoint arm skips, but the flush across the process boundary
is exactly what this change is about):

  wine startup_audio_output_validation.exe capture
    progress: open      capture arm starting
    progress: activate  requesting the process loopback client
    skip: process loopback activation result failed (0x80070002)      exit 77
  wine startup_audio_output_validation.exe            (isolation harness)
    isolation control: capture child=NNN interferer=NNN (siblings outside the captured tree)
    progress: harness   waiting up to 60 s for the capture child (its progress lines follow)
    progress: open      capture arm starting
    progress: activate  requesting the process loopback client
    skip: process loopback activation result failed (0x80070002)      exit 77
  wine startup_audio_output_validation.exe --self-test                 exit 0

Interleaving the child's lines into the parent's stream on this host shows the
flush working; which stage a real endpoint run stalls in is still his to
measure.
Author
Owner

@⁠triggered02 on GitHub · 2026-12-03 17:29 UTC · original

Hosted Windows jobs on 16c7df97 are green, and the relevant line is explicit: the device-free test ran on Windows and passed —

[289/336] Linking CXX executable startup_audio_output_validation.exe
Start 216: startup_audio_output_validation_classifier
8/352 Test #216: startup_audio_output_validation_classifier ............... Passed 0.19 sec

So the synthetic multichannel/plan case is now covered on the target platform without an endpoint, on every PR. The endpoint arm itself still needs a machine with an audio device — yours.

**@⁠triggered02** on GitHub · 2026-12-03 17:29 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1536#issuecomment-7386608042) Hosted Windows jobs on `16c7df97` are green, and the relevant line is explicit: the device-free test ran on Windows and passed — ``` [289/336] Linking CXX executable startup_audio_output_validation.exe Start 216: startup_audio_output_validation_classifier 8/352 Test #216: startup_audio_output_validation_classifier ............... Passed 0.19 sec ``` So the synthetic multichannel/plan case is now covered on the target platform without an endpoint, on every PR. The endpoint arm itself still needs a machine with an audio device — yours.
Author
Owner

@⁠triggered02 on GitHub · 2026-12-03 17:33 UTC · original

Good news in your retest first: the device-free classifier passed on Windows, including the multichannel, alignment and negative controls — that part of the work is now covered on the target platform.

For the capture arm, 20cc04f3 makes the child say where it is. The failure mode you hit was structural: the child's stdout is a pipe into the harness, and nothing in that arm was flushed, so a stall produced exactly the launch line and nothing else.

  • Every stage entry prints a flushed progress: line. open, activate (before the loopback request and once the client has activated), capture (format, isolation, endpoint buffer), caller, plan, baseline (how long quiet took), probe (stream latency), measure, each submitted tone block with the window count so far, silence, withheld, each resumption block, tail, and collected (window and frame totals).
  • stdout is unbuffered in the fixture, so a line cannot be lost when the parent gives up.
  • The harness has a heartbeat every 5 s while it waits, and its timeout message now says the last flushed progress: line names the stage the child entered — which is the only honest claim a parent can make about a child still inside a call.

Verified on this host (clang-cl 19 xwin, Wine + vkd3d-proton, no audio device):

$ wine startup_audio_output_validation.exe            # isolation harness
isolation control: capture child=276 interferer=232 (siblings outside the captured tree)
progress: harness   waiting up to 60 s for the capture child (its progress lines follow)
progress: open      capture arm starting
progress: activate  requesting the process loopback client
skip: process loopback activation result failed (0x80070002)      exit 77

The child's lines appear in the parent's stream in order — that interleaving is the evidence that the flush works across the process boundary. What it cannot tell you is which stage your machine's run stalls in; the next run will, and the last progress: line before the timeout names it.

--self-test still exits 0 with the same PASS line.

**@⁠triggered02** on GitHub · 2026-12-03 17:33 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1536#issuecomment-7386697291) Good news in your retest first: the device-free classifier passed on Windows, including the multichannel, alignment and negative controls — that part of the work is now covered on the target platform. For the capture arm, `20cc04f3` makes the child say where it is. The failure mode you hit was structural: the child's stdout is a pipe into the harness, and nothing in that arm was flushed, so a stall produced exactly the launch line and nothing else. - **Every stage entry prints a flushed `progress:` line.** `open`, `activate` (before the loopback request *and* once the client has activated), `capture` (format, isolation, endpoint buffer), `caller`, `plan`, `baseline` (how long quiet took), `probe` (stream latency), `measure`, each submitted tone block with the window count so far, `silence`, `withheld`, each resumption block, `tail`, and `collected` (window and frame totals). - **stdout is unbuffered** in the fixture, so a line cannot be lost when the parent gives up. - **The harness has a heartbeat** every 5 s while it waits, and its timeout message now says the last flushed `progress:` line names the stage the child entered — which is the only honest claim a parent can make about a child still inside a call. Verified on this host (clang-cl 19 xwin, Wine + vkd3d-proton, no audio device): ``` $ wine startup_audio_output_validation.exe # isolation harness isolation control: capture child=276 interferer=232 (siblings outside the captured tree) progress: harness waiting up to 60 s for the capture child (its progress lines follow) progress: open capture arm starting progress: activate requesting the process loopback client skip: process loopback activation result failed (0x80070002) exit 77 ``` The child's lines appear in the parent's stream in order — that interleaving is the evidence that the flush works across the process boundary. What it cannot tell you is which stage your machine's run stalls in; the next run will, and the last `progress:` line before the timeout names it. `--self-test` still exits 0 with the same PASS line.
The branch went DIRTY against main (`3b300328`, after #3943, #3949 and #3950
landed), and a conflicted pull request gets no `pull_request` run at all, so
the head had no CI. Both conflicts are additive:

- the build target list: main's lazy-texture, resource-retire and view-census
  targets stay, with `startup_audio_output_validation` appended;
- the `pr` test filter: main's alternatives stay, with
  `startup_audio_output_validation_classifier` appended (91 alternatives, 31
  `(` / 31 `)`), verified by `ctest -N -R` reporting 105 matched tests rather
  than `Too many parentheses`.
Author
Owner

@⁠triggered02 on GitHub · 2026-12-03 17:39 UTC · original

Heads-up on the CI you will see for the last two pushes: after 20cc04f3 the branch went DIRTY against main (3b300328, once #3945/#3949/#3950 landed), and a conflicted pull request gets no pull_request run at all — so that head had no checks rather than failing ones. a9b2dd6b merges current main; both conflicts were additive (build target list gains startup_audio_output_validation, the pr filter gains startup_audio_output_validation_classifier beside main's lazy-texture selectors — 91 alternatives, 31 ( / 31 ), ctest -N -R reports 105 matched tests). The self-test still passes on the merged tree, and the hosted run on a9b2dd6b is the check.

**@⁠triggered02** on GitHub · 2026-12-03 17:39 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1536#issuecomment-7386863805) Heads-up on the CI you will see for the last two pushes: after `20cc04f3` the branch went **DIRTY** against main (`3b300328`, once #3945/#3949/#3950 landed), and a conflicted pull request gets no `pull_request` run at all — so that head had no checks rather than failing ones. `a9b2dd6b` merges current main; both conflicts were additive (build target list gains `startup_audio_output_validation`, the `pr` filter gains `startup_audio_output_validation_classifier` beside main's lazy-texture selectors — 91 alternatives, 31 `(` / 31 `)`, `ctest -N -R` reports 105 matched tests). The self-test still passes on the merged tree, and the hosted run on `a9b2dd6b` is the check.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1536/head:github-bot/gh-1536'
git switch 'github-bot/gh-1536'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1536'
git switch 'github-bot/gh-1536'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1536'
git switch 'github-bot/gh-1536'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1536'
git switch 'main'
git merge --squash 'github-bot/gh-1536'
git switch 'main'
git merge --ff-only 'github-bot/gh-1536'
git switch 'main'
git merge 'github-bot/gh-1536'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.