startup-runtime: audio produces no output #1138

Open
opened 2026-11-24 01:45:34 +00:00 by denn0x · 26 comments
denn0x commented 2026-11-24 01:45:34 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by denn0x on 2026-11-24T01:45:34Z.


Problem

With X2W_AUDIO_PERMISSIVE=1 the audio HAL and APU stand-ins accept their calls but produce no output.

Done when

A minimal path renders the submitted buffers through WASAPI or XAudio2 on desktop, starting with a source-built
fixture that submits a known tone.

Context: docs/startup-runtime.md (#1135). Do not attach game files, dumps or logs that contain addresses or names from an executable; describe results in terms of the component tested.

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6572713980 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1145). Originally posted by [denn0x](https://github.com/denn0x) on 2026-11-24T01:45:34Z. --- ## Problem With `X2W_AUDIO_PERMISSIVE=1` the audio HAL and APU stand-ins accept their calls but produce no output. ## Done when A minimal path renders the submitted buffers through WASAPI or XAudio2 on desktop, starting with a source-built fixture that submits a known tone. Context: `docs/startup-runtime.md` (#1135). Do not attach game files, dumps or logs that contain addresses or names from an executable; describe results in terms of the component tested. AI-assisted (Claude Code).
R0Y00 commented 2026-11-24 06:50:18 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T04:16:49Z.


Open for one contributor to claim. Please reply here with your chosen desktop API (WASAPI or XAudio2) and the submission boundary you will instrument. This is the first implementation slice of #1145. The startup team will handle the application retest with your build.

On one Windows run the movie advanced through all 450 frames. During playback all 1,200 peak readings from the sampled process audio session were zero. The cause of the reported stutter remains open. #1071 already covers a source-built XApu caller and a recording provider. Its queue payload is a fixture convention and does not establish a PCM buffer layout.

Please deliver a source-built Windows fixture and the first real desktop buffer submission from the runtime path it exercises. Feed a short sequence of distinguishable PCM blocks, including a silent block, and record the first accepted block, sample format, submitted frame counts and actual consumption/completion. Use the selected API's clock, padding or voice completion events to identify consumption. Verify the generated tone on a dedicated or process-isolated capture path when available. Record endpoint capability skips separately.

Please exercise three cases in the same test: no submission; a continuously supplied stream including intentional silence; and deliberately withholding the next block until the playing queue drains, then resuming. Report the drained interval and recovery separately from any hardware/driver glitch count. These cases distinguish absent output, valid silent samples and producer starvation.

Suggested new CTest name: startup_audio_output. Proposed acceptance command: ctest --preset release --no-tests=error -R '^startup_audio_output$' -V. Include adapter/endpoint, Windows build, commit and per-case counters in your PR. Share only source-built fixtures and aggregate results.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7121873442 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1145#issuecomment-7121873442). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T04:16:49Z. --- **Open for one contributor to claim.** Please reply here with your chosen desktop API (WASAPI or XAudio2) and the submission boundary you will instrument. This is the first implementation slice of #1145. The startup team will handle the application retest with your build. On one Windows run the movie advanced through all 450 frames. During playback all 1,200 peak readings from the sampled process audio session were zero. The cause of the reported stutter remains open. #1071 already covers a source-built XApu caller and a recording provider. Its queue payload is a fixture convention and does not establish a PCM buffer layout. Please deliver a source-built Windows fixture and the first real desktop buffer submission from the runtime path it exercises. Feed a short sequence of distinguishable PCM blocks, including a silent block, and record the first accepted block, sample format, submitted frame counts and actual consumption/completion. Use the selected API's clock, padding or voice completion events to identify consumption. Verify the generated tone on a dedicated or process-isolated capture path when available. Record endpoint capability skips separately. Please exercise three cases in the same test: no submission; a continuously supplied stream including intentional silence; and deliberately withholding the next block until the playing queue drains, then resuming. Report the drained interval and recovery separately from any hardware/driver glitch count. These cases distinguish absent output, valid silent samples and producer starvation. Suggested new CTest name: `startup_audio_output`. Proposed acceptance command: `ctest --preset release --no-tests=error -R '^startup_audio_output$' -V`. Include adapter/endpoint, Windows build, commit and per-case counters in your PR. Share only source-built fixtures and aggregate results.
tedin7 commented 2026-11-24 06:50:26 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T05:24:30Z.


Claiming the first slice.

API: WASAPI shared mode (IMMDeviceEnumerator, IAudioClient, IAudioRenderClient, IAudioClock), mix format taken from GetMixFormat, blocks converted to it only when it is plain float or 16-bit PCM. Consumption is read from GetCurrentPadding and IAudioClock::GetPosition. A machine with no render endpoint (or one that refuses to initialise) reports a capability skip (exit 77), counted separately from pass and fail.

Submission boundary: a small desktop render sink under src/startup_stubs/ with one call, submit(format, frame count, bytes), which copies the block into the endpoint buffer and records the first accepted block, the format, the submitted frame counts and the consumed frames. I will not claim a PCM buffer layout for the console command queue: the XApuEnqueueCommand payload is still unknown (as noted for #1071), so xapu.cpp is not decoded in this slice. The source-built fixture drives the sink directly.

Fixture startup_audio_output: three cases in one test: no submission; a continuous stream of distinguishable blocks including an intentional silent block; and a producer that deliberately withholds the next block until the queue drains, then resumes. The drained interval and the recovery are reported separately from the glitch count. A capture-path check of the tone is not part of this slice. Draft PR to follow.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7122918624 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1145#issuecomment-7122918624). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T05:24:30Z. --- Claiming the first slice. **API:** WASAPI shared mode (IMMDeviceEnumerator, IAudioClient, IAudioRenderClient, IAudioClock), mix format taken from `GetMixFormat`, blocks converted to it only when it is plain float or 16-bit PCM. Consumption is read from `GetCurrentPadding` and `IAudioClock::GetPosition`. A machine with no render endpoint (or one that refuses to initialise) reports a capability skip (exit 77), counted separately from pass and fail. **Submission boundary:** a small desktop render sink under `src/startup_stubs/` with one call, submit(format, frame count, bytes), which copies the block into the endpoint buffer and records the first accepted block, the format, the submitted frame counts and the consumed frames. I will not claim a PCM buffer layout for the console command queue: the `XApuEnqueueCommand` payload is still unknown (as noted for #1071), so `xapu.cpp` is not decoded in this slice. The source-built fixture drives the sink directly. **Fixture `startup_audio_output`:** three cases in one test: no submission; a continuous stream of distinguishable blocks including an intentional silent block; and a producer that deliberately withholds the next block until the queue drains, then resumes. The drained interval and the recovery are reported separately from the glitch count. A capture-path check of the tone is not part of this slice. Draft PR to follow.
R0Y00 commented 2026-11-24 06:50:29 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T05:59:39Z.


The source-built WASAPI sink is on main via #1250 (3c7b78fb). Windows Release passed on a real shared-mode endpoint (44.1 kHz, eight-channel float mix). No submission registered zero frames; the eight-block stream, including silence, submitted and consumed 14,112 frames; the starvation case recorded a 307 ms drain and visible recovery 15 ms after resubmission.

This validates desktop submission and consumption from generated buffers. The console command payload, its integration with the sink, capture-path output and application audio remain open here.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7123468961 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1145#issuecomment-7123468961). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T05:59:39Z. --- The source-built WASAPI sink is on main via #1250 (3c7b78fb). Windows Release passed on a real shared-mode endpoint (44.1 kHz, eight-channel float mix). No submission registered zero frames; the eight-block stream, including silence, submitted and consumed 14,112 frames; the starvation case recorded a 307 ms drain and visible recovery 15 ms after resubmission. This validates desktop submission and consumption from generated buffers. The console command payload, its integration with the sink, capture-path output and application audio remain open here.
NinosTech commented 2026-11-24 10:02:39 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by NinosTech on 2026-11-24T09:15:44Z.


Source-built control for the audio HAL

A shared-ring test gave us an oracle for separating source decoding from desktop audio output. In a generated mono 48 kHz case, the first enable produced 2,048 PCM samples that matched FFmpeg byte for byte. Advancing the reader produced the next 512 samples, preserved the 1,536 unread samples and left a 256-byte guard intact. With enable omitted, both the context and the ring retained their sentinels. The same guest passed on our XCL build and VIctory d2a4bae1. This complements the proposed known-tone WASAPI/XAudio2 sink test. We have no Xbox2Windows pass or latency measurement for this fixture. AI-assisted report.

Full test record and revisions.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7127171702 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1145#issuecomment-7127171702). Originally posted by [NinosTech](https://github.com/NinosTech) on 2026-11-24T09:15:44Z. --- **Source-built control for the audio HAL** A shared-ring test gave us an oracle for separating source decoding from desktop audio output. In a generated mono 48 kHz case, the first enable produced 2,048 PCM samples that matched FFmpeg byte for byte. Advancing the reader produced the next 512 samples, preserved the 1,536 unread samples and left a 256-byte guard intact. With enable omitted, both the context and the ring retained their sentinels. The same guest passed on our XCL build and VIctory d2a4bae1. This complements the proposed known-tone WASAPI/XAudio2 sink test. We have no Xbox2Windows pass or latency measurement for this fixture. AI-assisted report. [Full test record and revisions](https://github.com/ivall/xcl/issues/42#issuecomment-7127023007).
triggered02 commented 2026-11-24 10:02:39 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-24T09:16:01Z.


May I claim the next slice here, in place of the inactive contributor?

Context on why I am asking rather than just starting: tedin7 claimed the first slice at 05:24 and it landed as #1250 at 05:58; I see no activity from them in this issue since. NinosTech posted the source-built control at 09:15, so that part is moving. If the remaining work is still meant to be single-owner and tedin7 is coming back, say so and I will stay off it — I do not want to duplicate a slice someone is mid-way through.

If it is open, I would take the playback timing slice rather than another sink.

Why that slice is the actionable one now. The title boots to the first-run UI on current main, and audio is no longer silent for two separate people: speech is audible but stutters — choppy chunks, pitch/delay wobble, sound arriving late and then catching up. That is not "no output", it is unstable pacing, so it points at the submission boundary and the clock, not at endpoint format support.

What I already measured on my own run (so this is not a cold start):

  • The title loads the real XAudio2_9.dll and a real AudioSes.dll session, so what plays is Windows audio, not our code.
  • Our stand-ins are involved earlier in the chain (AcpHal submit, XApuEnqueueCommand, XDspConnectWithMaximumStreamLimit), but AcpHal::submit is never called and XApuGetResultCount is polled fewer than 500 times in a 130 s run. So the APU stand-in is not the feeding path for the audible stream.
  • XApuEnqueueCommand is called with type 1/2 commands whose r9 steps by 0x100 per call, i.e. an advancing cursor, and the APU stand-in never produces results.
  • The process uses about one core of twelve (8.6%) at Normal priority with 98 threads, so this is not CPU starvation or a job-object CPU cap — I checked both.

Proposed scope for the slice: instrument the submission boundary that the audible stream actually crosses (which call feeds the XAudio2 voice, and at what cadence), produce a source-built control that distinguishes "steady 10 ms blocks" from "bursty blocks with gaps", and record the observed cadence and pacing error. I would report the cadence numbers with the control, not a pass/fail.

If you would rather I take a different slice (for example the XMA decode path in xapu/AcpHal, or supporting SQ_RSRC_IMG_2D_ARRAY in the shader translation, which is also blocking right now), tell me which and I will take that instead.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7127178075 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1145#issuecomment-7127178075). Originally posted by [triggered02](https://github.com/triggered02) on 2026-11-24T09:16:01Z. --- **May I claim the next slice here, in place of the inactive contributor?** Context on why I am asking rather than just starting: tedin7 claimed the first slice at 05:24 and it landed as #1250 at 05:58; I see no activity from them in this issue since. NinosTech posted the source-built control at 09:15, so that part is moving. If the remaining work is still meant to be single-owner and tedin7 is coming back, say so and I will stay off it — I do not want to duplicate a slice someone is mid-way through. If it is open, I would take the **playback timing** slice rather than another sink. **Why that slice is the actionable one now.** The title boots to the first-run UI on current main, and audio is no longer silent for two separate people: speech is audible but *stutters* — choppy chunks, pitch/delay wobble, sound arriving late and then catching up. That is not "no output", it is unstable pacing, so it points at the submission boundary and the clock, not at endpoint format support. **What I already measured on my own run** (so this is not a cold start): - The title loads the **real** `XAudio2_9.dll` and a real `AudioSes.dll` session, so what plays is Windows audio, not our code. - Our stand-ins are involved earlier in the chain (`AcpHal` submit, `XApuEnqueueCommand`, `XDspConnectWithMaximumStreamLimit`), but **`AcpHal::submit` is never called** and `XApuGetResultCount` is polled fewer than 500 times in a 130 s run. So the APU stand-in is not the feeding path for the audible stream. - `XApuEnqueueCommand` is called with type 1/2 commands whose `r9` steps by `0x100` per call, i.e. an advancing cursor, and the APU stand-in never produces results. - The process uses **about one core of twelve** (8.6%) at Normal priority with 98 threads, so this is **not** CPU starvation or a job-object CPU cap — I checked both. **Proposed scope for the slice:** instrument the submission boundary that the audible stream actually crosses (which call feeds the XAudio2 voice, and at what cadence), produce a source-built control that distinguishes "steady 10 ms blocks" from "bursty blocks with gaps", and record the observed cadence and pacing error. I would report the cadence numbers with the control, not a pass/fail. If you would rather I take a different slice (for example the XMA decode path in `xapu`/`AcpHal`, or supporting `SQ_RSRC_IMG_2D_ARRAY` in the shader translation, which is also blocking right now), tell me which and I will take that instead.
R0Y00 commented 2026-11-24 10:02:39 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T09:18:36Z.


@triggered02 Please take the playback-timing measurement as a separate slice. Keep #1250's sink and NinosTech's decode oracle as independent controls. On the actual audible path, record the first submission, frame count, clock/timestamps, underrun gaps and recovery against a source-built steady-versus-bursty input. Keep the provider behavior unchanged while measuring. An audible report and CPU utilization alone do not identify the stutter's source.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7127236802 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1145#issuecomment-7127236802). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T09:18:36Z. --- @triggered02 Please take the playback-timing measurement as a separate slice. Keep #1250's sink and NinosTech's decode oracle as independent controls. On the actual audible path, record the first submission, frame count, clock/timestamps, underrun gaps and recovery against a source-built steady-versus-bursty input. Keep the provider behavior unchanged while measuring. An audible report and CPU utilization alone do not identify the stutter's source.
triggered02 commented 2026-11-24 10:02:40 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-24T09:26:51Z.


Taken as a separate slice, with #1250's sink and NinosTech's decode oracle left as independent controls. First piece is up as #1368: a source-built steady-versus-bursty control that uses the existing sink and endpoint unchanged and records exactly the fields you listed.

Measured on this machine's shared-mode endpoint (float32, 2 ch, 48 kHz, 24000-frame buffer):

steady: first_submission_at=0.0ms blocks=120 frames=57600 clock=55728 largest_submit_gap=16.5ms drained_ms=0.0   recovery_ms=not measured
bursty: first_submission_at=0.0ms blocks=168 frames=80640 clock=80640 largest_submit_gap=158.9ms drained_ms=740.6 recovery_ms=16.0

So the control distinguishes the two: bursty feed produces a 740.6 ms drained interval the steady feed does not, and recovers in 16 ms. That is the sensitivity check the measurement needed before anything can be concluded about the title's own pacing — a control that could not tell steady from bursty would not be evidence.

Next step is the audible path itself: record the same fields (first submission, frame count, clock/timestamps, underrun gaps, recovery) at the submission boundary the title's audible stream actually crosses, with provider behaviour unchanged while measuring. From the title's side I have so far: the real XAudio2_9.dll and AudioSes.dll are what produce sound, AcpHal::submit is never called, and XApuGetResultCount is polled fewer than 500 times in 130 s — so the boundary to instrument is the one feeding the XAudio2 voice, not the APU stub. I will confirm where that lands before changing anything.

One limit worth stating up front: if the title's audible path turns out to be entirely inside system XAudio2 with no call of ours in between, the instrumentation needs a logging-only proxy for that import rather than a stand-in change. I will bring that as its own proposal rather than slipping it into this PR.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7127423784 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1145#issuecomment-7127423784). Originally posted by [triggered02](https://github.com/triggered02) on 2026-11-24T09:26:51Z. --- Taken as a separate slice, with #1250's sink and NinosTech's decode oracle left as independent controls. First piece is up as **#1368**: a source-built steady-versus-bursty control that uses the existing sink and endpoint unchanged and records exactly the fields you listed. Measured on this machine's shared-mode endpoint (float32, 2 ch, 48 kHz, 24000-frame buffer): ``` steady: first_submission_at=0.0ms blocks=120 frames=57600 clock=55728 largest_submit_gap=16.5ms drained_ms=0.0 recovery_ms=not measured bursty: first_submission_at=0.0ms blocks=168 frames=80640 clock=80640 largest_submit_gap=158.9ms drained_ms=740.6 recovery_ms=16.0 ``` So the control distinguishes the two: bursty feed produces a 740.6 ms drained interval the steady feed does not, and recovers in 16 ms. That is the sensitivity check the measurement needed before anything can be concluded about the title's own pacing — a control that could not tell steady from bursty would not be evidence. Next step is the audible path itself: record the same fields (first submission, frame count, clock/timestamps, underrun gaps, recovery) at the submission boundary the title's audible stream actually crosses, with provider behaviour unchanged while measuring. From the title's side I have so far: the real `XAudio2_9.dll` and `AudioSes.dll` are what produce sound, `AcpHal::submit` is never called, and `XApuGetResultCount` is polled fewer than 500 times in 130 s — so the boundary to instrument is the one feeding the XAudio2 voice, not the APU stub. I will confirm where that lands before changing anything. One limit worth stating up front: if the title's audible path turns out to be entirely inside system XAudio2 with no call of ours in between, the instrumentation needs a logging-only proxy for that import rather than a stand-in change. I will bring that as its own proposal rather than slipping it into this PR.
triggered02 commented 2026-11-24 11:02:58 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-24T10:12:57Z.


Proposal for the second half of the slice: a logging-only XAudio2 tap, so the pacing numbers come from the title's audible path instead of from my sink. Nothing is implemented yet; this is the design I would build, so you can redirect it before I spend the effort.

Boundary. The title imports XAudio2Create from XAudio2_9.dll (real system DLL; AudioSes.dll appears later as the WASAPI session). There is no call of ours in that path — AcpHal::submit is never called and XApuGetResultCount is polled under 500 times in 130 s. So the only way to see submissions is to sit between the title and that import.

Mechanism (reuses an in-tree pattern rather than inventing one): runtime_proxy.cpp already walks the main module's import directory and rewrites the IAT slot for GetProcAddress. The tap does the same for the XAudio2Create slot, forwards to the real export, and returns a wrapper object whose vtable dispatches through the same template <int N> forward(...) pattern that file already uses for provider objects, so every method forwards unchanged and only the ones I log are touched.

What I would record, matching the fields you listed:

  • IXAudio2CreateSourceVoice / CreateMasteringVoice / CreateSubmixVoice: the WAVEFORMATEX (rate, channels, bits, tag) — this alone would show a rate or channel mismatch between the title's blocks and the endpoint;
  • IXAudio2SourceVoice::SubmitSourceBuffer: monotonic timestamp, AudioBytes, PlayBegin/PlayLength, Flags, and the running block index — the raw material for first submission, block cadence, and gaps;
  • Start/Stop/Discontinuity and GetState (XAUDIO2_VOICE_STATE: BuffersQueued, SamplesPlayed) — sampled rather than polled hard, to give underrun and recovery without changing timing;
  • the existing startup_audio_pacing metrics computed from those numbers, so steady and bursty are reported in the same units as #1368.

Constraints I would hold to, because a tap that perturbs what it measures is worse than no tap:

  • off unless X2W_AUDIO_TAP=1;
  • logging only: no return value, argument or buffer is altered; the wrapper forwards before doing anything that could fail;
  • no allocation, no locking on the audio thread — a preallocated ring filled with plain stores, drained by a background writer;
  • timestamps from QueryPerformanceCounter taken at entry, nothing else;
  • the tap reports its own overhead (calls tapped, writer drops) so the measurements can be discounted if the writer falls behind.

What it would settle. If the title submits 10 ms blocks steadily and the endpoint still stutters, the fault is downstream of the title and the tap exonerates the producer. If submissions arrive in bursts with 100 ms gaps — which is what "stutters like 10 fps" sounds like — the numbers point back at the title's mixer, and the buffer sizes and voice state say whether it is starved or simply late.

Risks I want to name. The wrapper has to survive a vtable whose layout I only know from the public headers, so a wrong slot count would be a crash rather than a wrong number; the tap is per-process and cannot see system-side mixing; and if the title creates voices through an ordinal import instead of by name, the IAT walk needs the ordinal path too. I would verify the wrapper against the public IXAudio2 declaration before wiring it into a run.

Two alternatives, if you prefer a different boundary: tap the AudioSes/WASAPI layer instead (closer to the endpoint, further from the producer), or keep everything in the fixture and only accept numbers from my own sink (#1368 as it stands, which cannot speak for the title). My preference is the XAudio2 tap because it is the boundary where a producer-side stutter is visible.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7128473198 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1145#issuecomment-7128473198). Originally posted by [triggered02](https://github.com/triggered02) on 2026-11-24T10:12:57Z. --- Proposal for the second half of the slice: a **logging-only XAudio2 tap**, so the pacing numbers come from the title's audible path instead of from my sink. Nothing is implemented yet; this is the design I would build, so you can redirect it before I spend the effort. **Boundary.** The title imports `XAudio2Create` from `XAudio2_9.dll` (real system DLL; `AudioSes.dll` appears later as the WASAPI session). There is no call of ours in that path — `AcpHal::submit` is never called and `XApuGetResultCount` is polled under 500 times in 130 s. So the only way to see submissions is to sit between the title and that import. **Mechanism** (reuses an in-tree pattern rather than inventing one): `runtime_proxy.cpp` already walks the main module's import directory and rewrites the IAT slot for `GetProcAddress`. The tap does the same for the `XAudio2Create` slot, forwards to the real export, and returns a **wrapper object** whose vtable dispatches through the same `template <int N> forward(...)` pattern that file already uses for provider objects, so every method forwards unchanged and only the ones I log are touched. **What I would record**, matching the fields you listed: - `IXAudio2CreateSourceVoice` / `CreateMasteringVoice` / `CreateSubmixVoice`: the `WAVEFORMATEX` (rate, channels, bits, tag) — this alone would show a rate or channel mismatch between the title's blocks and the endpoint; - `IXAudio2SourceVoice::SubmitSourceBuffer`: monotonic timestamp, `AudioBytes`, `PlayBegin`/`PlayLength`, `Flags`, and the running block index — the raw material for first submission, block cadence, and gaps; - `Start`/`Stop`/`Discontinuity` and `GetState` (`XAUDIO2_VOICE_STATE`: `BuffersQueued`, `SamplesPlayed`) — sampled rather than polled hard, to give underrun and recovery without changing timing; - the existing `startup_audio_pacing` metrics computed from those numbers, so steady and bursty are reported in the same units as #1368. **Constraints I would hold to**, because a tap that perturbs what it measures is worse than no tap: - off unless `X2W_AUDIO_TAP=1`; - logging only: no return value, argument or buffer is altered; the wrapper forwards before doing anything that could fail; - no allocation, no locking on the audio thread — a preallocated ring filled with plain stores, drained by a background writer; - timestamps from `QueryPerformanceCounter` taken at entry, nothing else; - the tap reports its own overhead (calls tapped, writer drops) so the measurements can be discounted if the writer falls behind. **What it would settle.** If the title submits 10 ms blocks steadily and the endpoint still stutters, the fault is downstream of the title and the tap exonerates the producer. If submissions arrive in bursts with 100 ms gaps — which is what "stutters like 10 fps" sounds like — the numbers point back at the title's mixer, and the buffer sizes and voice state say whether it is starved or simply late. **Risks I want to name.** The wrapper has to survive a vtable whose layout I only know from the public headers, so a wrong slot count would be a crash rather than a wrong number; the tap is per-process and cannot see system-side mixing; and if the title creates voices through an ordinal import instead of by name, the IAT walk needs the ordinal path too. I would verify the wrapper against the public `IXAudio2` declaration before wiring it into a run. Two alternatives, if you prefer a different boundary: tap the `AudioSes`/WASAPI layer instead (closer to the endpoint, further from the producer), or keep everything in the fixture and only accept numbers from my own sink (#1368 as it stands, which cannot speak for the title). My preference is the XAudio2 tap because it is the boundary where a producer-side stutter is visible.
R0Y00 commented 2026-11-24 11:03:00 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T10:25:09Z.


#1368 is merged and gives us a timing control for the desktop sink. For the next slice, use a source-built client with an explicit diagnostic XAudio2 provider or factory. First verify that the same voice lifecycle, buffer arguments, callbacks and results are observed with diagnostics enabled and disabled. Record timestamps, frame counts, queue depth, drop counts and clock progress without recording audio bytes or user data. Keep the steady/bursty comparison and show that the disabled path calls the system provider directly. A steady submission stream would narrow the investigation to what happens after submission, but would leave voice state, queued playback and endpoint scheduling to verify.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7128753918 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1145#issuecomment-7128753918). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T10:25:09Z. --- #1368 is merged and gives us a timing control for the desktop sink. For the next slice, use a source-built client with an explicit diagnostic XAudio2 provider or factory. First verify that the same voice lifecycle, buffer arguments, callbacks and results are observed with diagnostics enabled and disabled. Record timestamps, frame counts, queue depth, drop counts and clock progress without recording audio bytes or user data. Keep the steady/bursty comparison and show that the disabled path calls the system provider directly. A steady submission stream would narrow the investigation to what happens after submission, but would leave voice state, queued playback and endpoint scheduling to verify.
triggered02 commented 2026-11-24 11:03:00 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-24T10:27:43Z.


Understood — not an IAT tap. I will take your formulation: a source-built client with an explicit diagnostic XAudio2 provider/factory, with the system provider as the other arm of the same client, so the comparison is between two explicit providers rather than between an intercepted and an untouched process.

Concretely, the shape I will build:

  • a small provider interface the client owns (create_voice(format), submit(buffer), start/stop, flush, state), with two implementations: a diagnostic provider that records the lifecycle and arguments, and a system provider that calls XAudio2Create and the real IXAudio2 directly — no import patching anywhere, so "the disabled path calls the system provider directly" is true by construction and visible in the code;
  • one client driving steady and bursty submission plans through whichever provider it is given, so the two arms differ only in the provider;
  • a per-arm trace of: voice lifecycle events (create → start → stop → destroy), buffer arguments (frames, flags, play region — no audio bytes and no user data), callbacks received, and results; plus timestamps, frame counts, queue depth, drop counts and clock progress.

The first check is the one you set as a precondition: diagnostics enabled and disabled must observe the same voice lifecycle, buffer arguments, callbacks and results. If they do not agree, the diagnostic arm is not a faithful window and any number from it is worthless — so the fixture fails on divergence before it compares pacing at all.

Then the steady/bursty comparison runs in both arms and reports the same quantities as #1368, so the earlier control stays directly comparable.

I am also recording your caveat as the interpretation limit, not as a footnote: a steady submission stream would narrow the fault to after submission — voice state, queued playback and endpoint scheduling would remain unverified by this slice. I will not claim the stutter is located until those are checked separately.

One question of scope, so I do not overbuild: I will keep the diagnostic provider to the lifecycle the client actually uses (source voice, buffer submission, callbacks, state) rather than mirroring all of IXAudio2. If you want a specific call in the diagnostic arm — for example GetState sampling as well as callbacks — say which and I will include it; otherwise I will include both and report which one disagrees first if they do.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7128812242 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1145#issuecomment-7128812242). Originally posted by [triggered02](https://github.com/triggered02) on 2026-11-24T10:27:43Z. --- Understood — not an IAT tap. I will take your formulation: a **source-built client with an explicit diagnostic XAudio2 provider/factory**, with the system provider as the other arm of the same client, so the comparison is between two explicit providers rather than between an intercepted and an untouched process. Concretely, the shape I will build: - a small provider interface the client owns (`create_voice(format)`, `submit(buffer)`, `start/stop`, `flush`, `state`), with two implementations: a **diagnostic provider** that records the lifecycle and arguments, and a **system provider** that calls `XAudio2Create` and the real `IXAudio2` directly — no import patching anywhere, so "the disabled path calls the system provider directly" is true by construction and visible in the code; - one client driving **steady** and **bursty** submission plans through whichever provider it is given, so the two arms differ only in the provider; - a per-arm trace of: voice lifecycle events (create → start → stop → destroy), buffer arguments (frames, flags, play region — **no audio bytes and no user data**), callbacks received, and results; plus timestamps, frame counts, **queue depth**, **drop counts** and **clock progress**. The first check is the one you set as a precondition: **diagnostics enabled and disabled must observe the same voice lifecycle, buffer arguments, callbacks and results**. If they do not agree, the diagnostic arm is not a faithful window and any number from it is worthless — so the fixture fails on divergence before it compares pacing at all. Then the steady/bursty comparison runs in both arms and reports the same quantities as #1368, so the earlier control stays directly comparable. I am also recording your caveat as the interpretation limit, not as a footnote: a steady submission stream would narrow the fault to **after** submission — voice state, queued playback and endpoint scheduling would remain unverified by this slice. I will not claim the stutter is located until those are checked separately. One question of scope, so I do not overbuild: I will keep the diagnostic provider to the lifecycle the client actually uses (source voice, buffer submission, callbacks, state) rather than mirroring all of `IXAudio2`. If you want a specific call in the diagnostic arm — for example `GetState` sampling as well as callbacks — say which and I will include it; otherwise I will include both and report which one disagrees first if they do.
triggered02 commented 2026-11-24 11:03:00 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-24T10:30:59Z.


Built as directed: #1399 — a source-built client with an explicit diagnostic provider, and the system provider as the other arm of the same client. No intercepting tap and no import patching anywhere; the diagnostics-disabled arm calls XAudio2Create and the real IXAudio2 directly in plain sight.

The precondition first. The fixture verifies both arms observe the same voice lifecycle, buffer arguments, callbacks and results for the same plan, and fails on divergence with the first differing event — before it reports any timing. That check earned its place immediately: it caught that my diagnostic arm did not advance its clock during withholding gaps, which made the bursty arm unfaithful by construction (divergence at event 3). Fixed, both arms are now faithful.

Measured (48 kHz stereo 16-bit, 120 blocks of 10 ms, shared-mode endpoint):

steady: faithful=yes
  diagnostic: events=243 frames=57600 callbacks=120 drops=0 depth_max=480  clock=57600
  system    : events=243 frames=57600 callbacks=120 drops=0 depth_max=480  clock=57600
bursty: faithful=yes
  diagnostic: events=243 frames=57600 callbacks=120 drops=0 depth_max=2880 clock=57600
  system    : events=243 frames=57600 callbacks=120 drops=0 depth_max=2880 clock=57600

Timestamp, frame count, queue depth, drop count and clock progress are all recorded per arm; no audio bytes and no user data are recorded or stored — the system arm submits silence.

I took the narrower reading of the scope you left open: the diagnostic provider covers the lifecycle the client uses (create, submit, start/stop, callbacks, state) rather than mirroring all of IXAudio2, and it samples GetState as well as counting callbacks so you can see which disagrees first if they do.

Your caveat is restated in the PR as a limit, not a footnote: a steady submission stream would narrow the fault to after submission and would still leave voice state, queued playback and endpoint scheduling to verify. I am not claiming this locates the stutter.

Ready for your review; if you want the diagnostic arm extended to a specific call before this is useful, name it and I will add it here rather than in a follow-up.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7128884256 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1145#issuecomment-7128884256). Originally posted by [triggered02](https://github.com/triggered02) on 2026-11-24T10:30:59Z. --- Built as directed: **#1399** — a source-built client with an explicit diagnostic provider, and the system provider as the other arm of the same client. No intercepting tap and no import patching anywhere; the diagnostics-disabled arm calls `XAudio2Create` and the real `IXAudio2` directly in plain sight. **The precondition first.** The fixture verifies both arms observe the same voice lifecycle, buffer arguments, callbacks and results for the same plan, and fails on divergence with the first differing event — before it reports any timing. That check earned its place immediately: it caught that my diagnostic arm did not advance its clock during withholding gaps, which made the bursty arm unfaithful by construction (divergence at event 3). Fixed, both arms are now faithful. Measured (48 kHz stereo 16-bit, 120 blocks of 10 ms, shared-mode endpoint): ``` steady: faithful=yes diagnostic: events=243 frames=57600 callbacks=120 drops=0 depth_max=480 clock=57600 system : events=243 frames=57600 callbacks=120 drops=0 depth_max=480 clock=57600 bursty: faithful=yes diagnostic: events=243 frames=57600 callbacks=120 drops=0 depth_max=2880 clock=57600 system : events=243 frames=57600 callbacks=120 drops=0 depth_max=2880 clock=57600 ``` Timestamp, frame count, queue depth, drop count and clock progress are all recorded per arm; **no audio bytes and no user data are recorded or stored** — the system arm submits silence. I took the narrower reading of the scope you left open: the diagnostic provider covers the lifecycle the client uses (create, submit, start/stop, callbacks, state) rather than mirroring all of `IXAudio2`, and it samples `GetState` as well as counting callbacks so you can see which disagrees first if they do. Your caveat is restated in the PR as a limit, not a footnote: a steady submission stream would narrow the fault to after submission and would still leave voice state, queued playback and endpoint scheduling to verify. I am not claiming this locates the stutter. Ready for your review; if you want the diagnostic arm extended to a specific call before this is useful, name it and I will add it here rather than in a follow-up.
R0Y00 commented 2026-11-24 13:00:52 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T12:08:14Z.


The mixer timer change landed in #1448. Independent Windows Release check at e8003928 with a source-built caller: median Sleep(2) was 15.54 ms before connecting, 2.44 ms with two connections, 2.51 ms after one disconnect, and 15.42 ms after the last disconnect. The existing startup_stubs test also passed. This confirms the timer lifetime and refill timing on this host. Keep the independent buffer-submit and output validation tracked here.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7131016286 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1145#issuecomment-7131016286). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T12:08:14Z. --- The mixer timer change landed in #1448. Independent Windows Release check at e8003928 with a source-built caller: median Sleep(2) was 15.54 ms before connecting, 2.44 ms with two connections, 2.51 ms after one disconnect, and 15.42 ms after the last disconnect. The existing startup_stubs test also passed. This confirms the timer lifetime and refill timing on this host. Keep the independent buffer-submit and output validation tracked here.
triggered02 commented 2026-11-24 14:03:23 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-24T13:11:49Z.


Requesting permission for a different kind of slice than the ones already landed here.

Why I want to stop measuring and change the path

The measurements so far are sound, but they share one property: none of them sits on the title's audible path. On my runs the title loads the real XAudio2_9.dll and a real AudioSes.dll session, so what plays is Windows mixing the title's own submissions. Meanwhile:

  • AcpHal::submit is never called;
  • XApuGetResultCount is polled fewer than 500 times in a 130 s run, and the APU stand-in never produces results;
  • the process uses ~8.6% of one core at Normal priority, so this is not CPU starvation.

That means our audio stack is not in the chain that produces the stutter. #1368's steady-versus-bursty control and #1399's diagnostic provider both characterise a sink we own — they establish that our boundary can report pacing faithfully, which is why they were worth doing — but they cannot move the title's audio, because the title never reaches that boundary. The mixer-timer work in #1448 is the same shape: real and verified, but on the desktop mixer, not on the console submission path.

So if the goal of this issue is eventually "the title's audio comes out of our runtime predictably", continuing to measure the sink will not get there. The question is whether we are allowed to put our own path in the chain on purpose.

What I am asking to build

A first real desktop submission path that the runtime owns end to end, rather than a measurement of someone else's:

  1. A stand-alone XAudio2 provider arm we own — same shape as #1399's diagnostic/system pair, but instead of measuring, it becomes the actual playback path: our sink (#1250) is the consumer, with a submit queue whose clock is derived from frames consumed, so pacing is ours to get right rather than the system's to interpret. Behind X2W_AUDIO_OWN=1; with the variable unset, the real DLL is used exactly as today.
  2. The console-side entry points wired into it but still not decoded — AcpHal::submit and XApuEnqueueCommand are called with an advancing command cursor; I would record their call shape (type, counts, cadence — no audio bytes) and, if the payload layout cannot be established safely, keep synthesising silence from the shape rather than inventing a PCM layout for a queue whose format we do not know. #1071's warning about not claiming a buffer layout stands.
  3. A source-built control with the three cases the issue already asks for: no submission; continuous stream with intentional silence; withholding until the queue drains then resuming. Same reporting fields as #1368 so it stays directly comparable, plus one new one: measured pacing error against the frame clock (not just gaps), because "stutters" is a timing-error statement and nothing in the current numbers expresses it.
  4. A comparison run: the same source-built caller once through the real DLL and once through our arm, reporting the pacing error in both. That is the only way to say whether our path is better, worse, or indistinguishable — and it is a comparison of two explicit providers, as you asked for in the #1399 direction, not an interception.

What I am explicitly not asking to do

  • Not to intercept or patch the IAT — you rejected that for #1399 and I agree it perturbs what it measures.
  • Not to claim a console PCM layout we have not established.
  • Not to record audio bytes or user data; aggregate numbers and call shapes only.
  • Not to touch #1250's sink, NinosTech's decode oracle, or #1368's control — they stay independent.

The scope question I want your answer on

Replacing the real XAudio2_9.dll path with an arm we own is a bigger step than the sink work, and it decides whether this issue becomes "validate the desktop's output" or "own the audio output". If you would rather keep the real DLL and only validate what it produces (capture-path verification of the tone), say so and I will take that slice instead — it is narrower and it keeps the system mixer in the chain. My preference is our own arm, because the stutter is a pacing question and pacing is the thing the system mixer hides from us.

I will not start until you pick one. AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7132485311 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1145#issuecomment-7132485311). Originally posted by [triggered02](https://github.com/triggered02) on 2026-11-24T13:11:49Z. --- Requesting permission for a different kind of slice than the ones already landed here. ## Why I want to stop measuring and change the path The measurements so far are sound, but they share one property: **none of them sits on the title's audible path.** On my runs the title loads the real `XAudio2_9.dll` and a real `AudioSes.dll` session, so what plays is Windows mixing the title's own submissions. Meanwhile: - `AcpHal::submit` is never called; - `XApuGetResultCount` is polled fewer than 500 times in a 130 s run, and the APU stand-in never produces results; - the process uses ~8.6% of one core at Normal priority, so this is not CPU starvation. That means our audio stack is not in the chain that produces the stutter. #1368's steady-versus-bursty control and #1399's diagnostic provider both characterise **a sink we own** — they establish that our boundary can report pacing faithfully, which is why they were worth doing — but they cannot move the title's audio, because the title never reaches that boundary. The mixer-timer work in #1448 is the same shape: real and verified, but on the desktop mixer, not on the console submission path. So if the goal of this issue is eventually "the title's audio comes out of our runtime predictably", continuing to measure the sink will not get there. The question is whether we are allowed to **put our own path in the chain on purpose**. ## What I am asking to build A first real desktop submission path that the runtime owns end to end, rather than a measurement of someone else's: 1. **A stand-alone `XAudio2` provider arm we own** — same shape as #1399's diagnostic/system pair, but instead of measuring, it becomes the actual playback path: our sink (#1250) is the consumer, with a submit queue whose clock is derived from frames consumed, so pacing is ours to get right rather than the system's to interpret. Behind `X2W_AUDIO_OWN=1`; with the variable unset, the real DLL is used exactly as today. 2. **The console-side entry points wired into it but still not decoded** — `AcpHal::submit` and `XApuEnqueueCommand` are called with an advancing command cursor; I would record their call shape (type, counts, cadence — no audio bytes) and, if the payload layout cannot be established safely, keep synthesising silence from the shape rather than inventing a PCM layout for a queue whose format we do not know. #1071's warning about not claiming a buffer layout stands. 3. **A source-built control with the three cases the issue already asks for**: no submission; continuous stream with intentional silence; withholding until the queue drains then resuming. Same reporting fields as #1368 so it stays directly comparable, plus one new one: **measured pacing error against the frame clock** (not just gaps), because "stutters" is a timing-error statement and nothing in the current numbers expresses it. 4. **A comparison run**: the same source-built caller once through the real DLL and once through our arm, reporting the pacing error in both. That is the only way to say whether our path is better, worse, or indistinguishable — and it is a comparison of two explicit providers, as you asked for in the #1399 direction, not an interception. ## What I am explicitly not asking to do - Not to intercept or patch the IAT — you rejected that for #1399 and I agree it perturbs what it measures. - Not to claim a console PCM layout we have not established. - Not to record audio bytes or user data; aggregate numbers and call shapes only. - Not to touch #1250's sink, NinosTech's decode oracle, or #1368's control — they stay independent. ## The scope question I want your answer on Replacing the real `XAudio2_9.dll` path with an arm we own is a bigger step than the sink work, and it decides whether this issue becomes "validate the desktop's output" or "own the audio output". If you would rather keep the real DLL and only validate what it produces (capture-path verification of the tone), say so and I will take **that** slice instead — it is narrower and it keeps the system mixer in the chain. My preference is our own arm, because the stutter is a pacing question and pacing is the thing the system mixer hides from us. I will not start until you pick one. AI-assisted (Claude Code).
triggered02 commented 2026-11-24 14:03:24 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-24T13:18:59Z.


While the path question above is open, one piece of it does not depend on your answer: #1508 adds pacing error against the ideal cadence to the existing control.

The reasoning: #1368 reports gaps, drained interval and recovery, which shows that a feed starved. It cannot express drift — how far each submission landed from where it should have been — and "stutters" is precisely a drift statement. Measured on this machine's endpoint:

steady: pacing_error_max=15.9ms pacing_error_rms=9.1ms
bursty: pacing_error_max=1847.5ms pacing_error_rms=1060.4ms
timer:  Sleep(1) median 15.5 ms, steady bound 46.6 ms

The steady bound comes from the host's measured Sleep tick (three ticks), not a fixed number, matching what #1448 found here; the fixture fails unless the bursty feed drifts further than the steady one, so the metric has to be sensitive to pass rather than merely non-zero.

This is deliberately not the path-level work. It sharpens the same sink boundary and cannot locate the title's stutter, which is why #1145 stays open for your direction on the two options in my previous comment. AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7132654298 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1145#issuecomment-7132654298). Originally posted by [triggered02](https://github.com/triggered02) on 2026-11-24T13:18:59Z. --- While the path question above is open, one piece of it does not depend on your answer: **#1508** adds pacing error against the ideal cadence to the existing control. The reasoning: #1368 reports gaps, drained interval and recovery, which shows *that* a feed starved. It cannot express drift — how far each submission landed from where it should have been — and "stutters" is precisely a drift statement. Measured on this machine's endpoint: ``` steady: pacing_error_max=15.9ms pacing_error_rms=9.1ms bursty: pacing_error_max=1847.5ms pacing_error_rms=1060.4ms timer: Sleep(1) median 15.5 ms, steady bound 46.6 ms ``` The steady bound comes from the host's measured Sleep tick (three ticks), not a fixed number, matching what #1448 found here; the fixture fails unless the bursty feed drifts further than the steady one, so the metric has to be sensitive to pass rather than merely non-zero. This is deliberately *not* the path-level work. It sharpens the same sink boundary and cannot locate the title's stutter, which is why #1145 stays open for your direction on the two options in my previous comment. AI-assisted (Claude Code).
R0Y00 commented 2026-11-24 14:03:24 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T13:23:30Z.


Please take the narrower output-validation slice first and keep the real XAudio2 provider in the launch path. Use a source-built caller and an isolated test endpoint with a known tone, intentional silence, then a drain-and-resume sequence. Report only aggregate output timing, tone/silence classification and recovery relative to the sample clock. Keep all audio bytes local and avoid changing the ability to run with the existing provider. A decoder or a replacement provider can be evaluated separately after this establishes which pacing error reaches the endpoint.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7132762179 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1145#issuecomment-7132762179). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T13:23:30Z. --- Please take the narrower output-validation slice first and keep the real XAudio2 provider in the launch path. Use a source-built caller and an isolated test endpoint with a known tone, intentional silence, then a drain-and-resume sequence. Report only aggregate output timing, tone/silence classification and recovery relative to the sample clock. Keep all audio bytes local and avoid changing the ability to run with the existing provider. A decoder or a replacement provider can be evaluated separately after this establishes which pacing error reaches the endpoint.
triggered02 commented 2026-11-24 14:03:25 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-24T13:27:37Z.


Taking the output-validation slice, keeping the real XAudio2 provider in the launch path. One constraint to settle before I build, because it decides what "isolated test endpoint" can mean on this machine.

What is physically available

Windows does not let a process create an audio endpoint; endpoints come from drivers. On this host IMMDeviceEnumerator has the usual render devices (no virtual cable installed). So there are two ways to observe real output, and neither is a separate endpoint:

  1. WASAPI loopback capture on the endpoint the provider actually renders to (AUDCLNT_STREAMFLAGS_LOOPBACK). This sees the post-mix output, so it validates the real path end to end — including the real XAudio2 — but the capture is of the shared endpoint, and other processes could mix into it.
  2. Exclusive-mode render (AUDCLNT_SHAREMODE_EXCLUSIVE): our stream owns the endpoint, so nothing else can mix — that is the closest thing to isolation available without a driver — but exclusive mode frequently refuses a format, and it rules out loopback capture at the same time.

What I propose to build

A source-built caller that uses the real XAudio2 provider (unchanged XAudio2Create path, same as startup_audio_provider.cpp) with the plan you specified: known tone → intentional silence → drain-and-resume. The observer is loopback capture of the endpoint the provider renders to, and the fixture reports which isolation it actually got rather than assuming:

  • attempt IAudioClient2/IAudioClient on the provider's endpoint; try exclusive first, fall back to shared and report isolation=exclusive or isolation=shared;
  • per 10 ms window, classify tone present / silence by power at the caller's tone frequency (Goertzel), and report the aggregate: first onset, tone/silence transition timestamps relative to the sample clock (IAudioClock::GetPosition), drained interval, recovery after resubmission;
  • skip with exit 77 and a distinct message when there is no endpoint, loopback is refused, or exclusive is required but unavailable;
  • no audio bytes stored or printed — only counts, timestamps and classifications; everything else stays in memory and is discarded;
  • nothing about the launch path or provider selection changes, so runs with the existing provider behave exactly as today.

The two questions

  1. Is loopback-on-the-rendered-endpoint acceptable as the observer, with the isolation actually achieved reported per run (exclusive vs shared), or do you want the fixture to require exclusive isolation and skip otherwise? The latter is cleaner evidence but will skip on more machines.
  2. If you meant a literal separate endpoint (a virtual device we configure per machine), that needs a driver on the CI host — I have not installed anything and would rather not start. Say if that is the expectation and I will report it as an environment prerequisite instead of building around it.

I will start with the caller plan and the classifier, which are the same either way, and land the endpoint decision after your answer. AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7132860085 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1145#issuecomment-7132860085). Originally posted by [triggered02](https://github.com/triggered02) on 2026-11-24T13:27:37Z. --- Taking the output-validation slice, keeping the real XAudio2 provider in the launch path. One constraint to settle before I build, because it decides what "isolated test endpoint" can mean on this machine. ## What is physically available Windows does not let a process create an audio endpoint; endpoints come from drivers. On this host `IMMDeviceEnumerator` has the usual render devices (no virtual cable installed). So there are two ways to observe real output, and neither is a separate endpoint: 1. **WASAPI loopback capture** on the endpoint the provider actually renders to (`AUDCLNT_STREAMFLAGS_LOOPBACK`). This sees the post-mix output, so it validates the real path end to end — including the real `XAudio2` — but the capture is of the shared endpoint, and other processes could mix into it. 2. **Exclusive-mode render** (`AUDCLNT_SHAREMODE_EXCLUSIVE`): our stream owns the endpoint, so nothing else can mix — that is the closest thing to isolation available without a driver — but exclusive mode frequently refuses a format, and it rules out loopback capture at the same time. ## What I propose to build A source-built caller that uses the **real** XAudio2 provider (unchanged `XAudio2Create` path, same as `startup_audio_provider.cpp`) with the plan you specified: known tone → intentional silence → drain-and-resume. The observer is **loopback capture of the endpoint the provider renders to**, and the fixture **reports which isolation it actually got** rather than assuming: - attempt `IAudioClient2`/`IAudioClient` on the provider's endpoint; try exclusive first, fall back to shared and report `isolation=exclusive` or `isolation=shared`; - per 10 ms window, classify **tone present / silence** by power at the caller's tone frequency (Goertzel), and report the aggregate: first onset, tone/silence transition timestamps relative to the **sample clock** (`IAudioClock::GetPosition`), drained interval, recovery after resubmission; - skip with exit 77 and a distinct message when there is no endpoint, loopback is refused, or exclusive is required but unavailable; - **no audio bytes stored or printed** — only counts, timestamps and classifications; everything else stays in memory and is discarded; - nothing about the launch path or provider selection changes, so runs with the existing provider behave exactly as today. ## The two questions 1. Is loopback-on-the-rendered-endpoint acceptable as the observer, with the isolation actually achieved reported per run (`exclusive` vs `shared`), or do you want the fixture to **require** exclusive isolation and skip otherwise? The latter is cleaner evidence but will skip on more machines. 2. If you meant a literal separate endpoint (a virtual device we configure per machine), that needs a driver on the CI host — I have not installed anything and would rather not start. Say if that is the expectation and I will report it as an environment prerequisite instead of building around it. I will start with the caller plan and the classifier, which are the same either way, and land the endpoint decision after your answer. AI-assisted (Claude Code).
triggered02 commented 2026-11-24 14:03:26 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-24T13:45:12Z.


The output-validation slice is up as #1536, with the caller driving the real XAudio2 provider and WASAPI loopback classifying what the endpoint produced.

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 + 2000 ms withheld)

Three things had to be fixed before these numbers meant anything, and they are the reason I did not post earlier with a "passing" run:

  1. The endpoint buffer sizes the plan. This host's shared buffer is 1000 ms, so my original 80/40/300 ms plan was shorter than the buffer and the mix smeared it into one blob — the phases were not separable, and a test that "passed" on it would have been measuring nothing. The plan is now derived from GetBufferSize.
  2. Silent loopback packets are time on the endpoint. Skipping them spliced the stream across gaps and made an 80 ms tone read as ~500 ms.
  3. Timestamps must come from the sample clock. Arrival-time stamping gave negative offsets and duplicate window times.

Per your direction, the report is aggregate only — no audio bytes are stored or printed — and I assert the structure (tone → silence of the planned length → tone) rather than absolute latencies, because this machine's endpoint start latency ranges 60–775 ms and that is a property of the machine, not of the plan.

Two limits worth stating plainly:

  • isolation=shared, reported per run. Windows cannot create an audio endpoint without a driver, so a genuinely separate test endpoint is an environment prerequisite (a virtual device on the host) rather than something the fixture can arrange. That is the point I raised earlier and it still stands.
  • This does not locate the title's stutter. It establishes that a source-built caller's blocks reach the endpoint through the real XAudio2 path, which is the precondition for using this boundary to speak about the title's pacing at all.

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7133285000 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1145#issuecomment-7133285000). Originally posted by [triggered02](https://github.com/triggered02) on 2026-11-24T13:45:12Z. --- The output-validation slice is up as **#1536**, with the caller driving the real XAudio2 provider and WASAPI loopback classifying what the endpoint produced. 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 + 2000 ms withheld) ``` Three things had to be fixed before these numbers meant anything, and they are the reason I did not post earlier with a "passing" run: 1. **The endpoint buffer sizes the plan.** This host's shared buffer is 1000 ms, so my original 80/40/300 ms plan was shorter than the buffer and the mix smeared it into one blob — the phases were not separable, and a test that "passed" on it would have been measuring nothing. The plan is now derived from `GetBufferSize`. 2. **Silent loopback packets are time on the endpoint.** Skipping them spliced the stream across gaps and made an 80 ms tone read as ~500 ms. 3. **Timestamps must come from the sample clock.** Arrival-time stamping gave negative offsets and duplicate window times. Per your direction, the report is aggregate only — no audio bytes are stored or printed — and I assert the *structure* (tone → silence of the planned length → tone) rather than absolute latencies, because this machine's endpoint start latency ranges 60–775 ms and that is a property of the machine, not of the plan. Two limits worth stating plainly: - **`isolation=shared`**, reported per run. Windows cannot create an audio endpoint without a driver, so a genuinely separate test endpoint is an environment prerequisite (a virtual device on the host) rather than something the fixture can arrange. That is the point I raised earlier and it still stands. - This does **not** locate the title's stutter. It establishes that a source-built caller's blocks reach the endpoint through the real XAudio2 path, which is the precondition for using this boundary to speak about the title's pacing at all. AI-assisted (Claude Code).
R0Y00 commented 2026-11-24 14:03:27 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T13:56:09Z.


Please use WASAPI process loopback scoped to the source-built test process on supported Windows versions. That arm can retain the real XAudio2 provider and the tone/silence/drain sequence without a separate device or a system-wide recording. Aggregate in memory and publish the timing and classification only. Report a capability skip if process loopback is unavailable. Microsoft documents that exclusive mode cannot do loopback. https://github.com/microsoft/Windows-classic-samples/blob/main/Samples/ApplicationLoopback/README.md https://learn.microsoft.com/en-us/windows/win32/coreaudio/loopback-recording

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7133561734 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1145#issuecomment-7133561734). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T13:56:09Z. --- Please use WASAPI process loopback scoped to the source-built test process on supported Windows versions. That arm can retain the real XAudio2 provider and the tone/silence/drain sequence without a separate device or a system-wide recording. Aggregate in memory and publish the timing and classification only. Report a capability skip if process loopback is unavailable. Microsoft documents that exclusive mode cannot do loopback. https://github.com/microsoft/Windows-classic-samples/blob/main/Samples/ApplicationLoopback/README.md https://learn.microsoft.com/en-us/windows/win32/coreaudio/loopback-recording
NiiRoZz commented 2026-11-24 22:01:06 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by NiiRoZz on 2026-11-24T21:58:58Z.


Proposing a roadmap for replacing X2W_AUDIO_PERMISSIVE with a real implementation, so that the remaining slices here and on #1887 have an agreed order. Nothing below is implemented. Please redirect anything that conflicts with an existing track; I will claim individual slices here before starting any of them.

Draft, 2026-11-24, against upstream main at 2a27507a. This is a plan, not a measurement. Every
"seen" below is one local observation unless a PR or issue is cited; layouts are observations, not
facts.

Goal and definition of done

X2W_AUDIO_PERMISSIVE makes the three console audio stand-ins (AcpHal.dll, xapu.dll,
chad.dll) accept calls they cannot serve, so startup continues with no console audio. The goal is
to replace that with a real implementation. The flag is gone when all of these hold:

  1. No permissive() branch is left in acphal.cpp, xapu.cpp or chad.cpp, and run.ps1 no
    longer sets the flag.
  2. Every export the title reaches either implements its contract, checked by a source-built caller,
    or returns a documented failure. For a documented failure, a run must show the title handles it.
    An export the title never reaches still traps.
  3. A startup run's process-loopback capture (startup-audio-timeline.md)
    shows non-silent audio in windows known to be audible. The #1508 pacing metric shows no stutter.
  4. The three tests that use the flag's trap arm as a negative control keep an equivalent control
    (see Phase 6). No test is weakened or deleted.

What the flag does today (upstream main)

Module Under the flag Without the flag
AcpHal.dll Real heap: ApuCreateHeap, first-fit ApuAlloc/ApuFree, address map and validity. XMA shape contexts are allocated and cleared; other context types return E_NOTIMPL. The HAL object's slot 0 (connect) and slot 2 (submit) return S_OK and write nothing; other slots trap. Traps
xapu.dll Handles are tracked. Each XApuEnqueueCommand queues one completion. XApuDequeueResult returns an all-zero 0x58-byte placeholder result. The 16-byte output of XApuConnect is never written. A 1 ms timer is held while connected (#1448). Traps
chad.dll Connect validates its out-handle (#1871). XDspActivate clears its outputs and returns XDSP_E_NO_DEVICE_RESOURCES; submit refuses unknown handles (#1907). Deactivate and disconnect return 0 for any handle. Traps

AcpHalReleaseShapeContexts traps in both modes. Nothing in the console path produces samples. The
WASAPI sink (audio_sink.{h,cpp}, #1250) exists, but nothing feeds it.

What is known about the title's audio path

  • The audible output does not pass through the stand-ins. In #1145, triggered02 reports that
    the title loads the system XAudio2_9.dll and an AudioSes.dll session. Speech is audible but
    stutters. The local video DLL also imports XAudio2_9.dll ordinal 1
    (experiments.md).
  • The console path is used alongside it. One local run saw these calls:
    • ApuCreateHeap with about 455 MiB cached and 2.2 MiB non-cached.
    • Shape-context counts 0,0,0,0,350,0, so only XMA contexts are requested (350 × 64 bytes).
    • A HAL connect with two 4096-entry queues.
    • HAL submits of types 2 and 5; the type 5 submits used indices 0 to 14.
    • One XApuConnect, then type 1 and type 2 commands. The type 1 command holds 48000 at +0x38
      and pointers. The fifth argument (r9) of the type 2 commands advances by about 0x100 per call.
    • XDsp convolution activations: type 1, 1024-frame blocks, mono, impulse responses of 40,960 to
      208,896 floats. This was a local branch build; on main, activation is refused.
  • The first 24 calls are all we have. Logging is capped (first_calls(calls, 24)), so the
    command-type list is incomplete.
  • The two runs disagree. triggered02 saw AcpHal::submit never called and fewer than 500
    XApuGetResultCount polls in 130 s. The local run saw 48 submits. The builds or stages probably
    differ; this needs a recorded commit for each run.
  • Desktop XAudio2 has no XMA decoder. Any XMA content (XAudio2 voices or SHAPE contexts) is
    silent today. The title asks for 350 XMA contexts, so this is likely most of the missing audio.

Open questions (Phase 0 answers these)

# Question Why it decides the plan
Q1 Which source-voice formats does the title create on XAudio2 (PCM, ADPCM, xWMA, XMA2)? Do XMA2 voice creations fail on desktop, and how does the title react? Decides whether XMA decode belongs behind XAudio2 or behind SHAPE.
Q2 Does the title fill the XMA shape contexts and submit them through the HAL? Where is the decoded PCM supposed to land: APU heap buffers, an XAudio2 voice, or XApu? Decides the SHAPE emulation scope.
Q3 What do XApu command types mean, which result types (1 to 5) does the caller's switch consume, and what does it read at +4 and +0x34? Without this the queue cannot be implemented truthfully.
Q4 After XDSP_E_NO_DEVICE_RESOURCES, does the title fall back cleanly (dry signal, no reverb) or lose sound? Partly answered: in one local run without a debugger, on a build with #1907's refusal, 8 activations were refused, no submit followed, there was no crash, and the title stayed alive several minutes into the main load. What it does with the sound is unmeasured. Decides whether refusal is an acceptable permanent behaviour or convolution must be implemented.
Q5 What causes the stutter on the XAudio2 path? Separate from the flag, but item 3 of the definition of done needs it.

Phases

Phase 0: Evidence (blocks everything)

  • Run a full capture with the cap lifted. Record every stand-in call with its arguments across
    startup, menus and gameplay, plus the commit and build of the run. Do this locally and publish
    aggregates only.
  • Do a static analysis of the callers: the XApu result switch, the HAL submit sites, the XMA context
    writes, and the XAudio2 CreateSourceVoice format arguments. Keep this local, with no dumps in
    issues or PRs.
  • Answer Q1 to Q5 with a recorded commit for each answer.
  • Measuring XAudio2 inside the title needs a logging boundary. The owner refused an IAT tap for the
    #1399 measurement and asked for explicit providers. Raise this on #1145 before building anything.

Phase 1: Stand-ins that do not lie (rest of #1887)

The remaining rows of #1887, one narrow PR each, each with a source-built caller and a negative
control that fails when the old behaviour returns:

  • The XApuConnect 16-byte output: write it if the caller reads it, otherwise document that it does
    not (Q3).
  • XApuDequeueResult: replace the zero placeholder with measured fields, or fail.
  • AcpHal slot 0 and slot 2: write what the callers read back, or fail.
  • XDspDeactivate and XDspDisconnect: refuse null and unknown handles.

#1902 is open on acphal.cpp. Wait for it to land or rebase on it.

Phase 2: Audible-path pacing (#1145, triggered02's track)

Find the stutter's root cause on the XAudio2 path with the existing controls (#1368, #1508, #1536).
Fix the cause, not the buffer size. This phase does not touch the flag but blocks item 3 of the
definition of done.

Phase 3: XMA decode

  • Implement a software XMA2 decoder. Its placement follows Q1 and Q2:
    • SHAPE emulation in AcpHal: a worker processes the XMA contexts at the hardware frame
      cadence. It reads packets from the APU heap, writes PCM to the output buffers and posts
      completions to the HAL message queue.
    • Behind XAudio2: XMA2 source voices become PCM voices. This needs the owner's agreement on a
      provider in the XAudio2 path. They asked to keep the real provider and to evaluate a decoder or
      replacement provider separately.
  • Two decisions belong to the user and the owner:
    • Licence. The project is MIT. FFmpeg's XMA/WMA Pro decoder is LGPL, and the external provider
      named in #870 is GPL. The options are a clean-room MIT decoder or an optional, separately loaded
      provider.
    • Fixture source. There is no public XMA encoder. NinosTech's decode oracle on #1145 matched
      FFmpeg on a generated stream; ask how that stream was produced and under what licence.

Phase 4: XApu command queue

Implement the commands decoded in Q3. Results carry measured fields and complete at a measured
cadence, driven by the audio clock (IAudioClock consumption) rather than at enqueue time. If XApu
carries final PCM, route it to audio_sink. Otherwise it stays a control channel.

Phase 5: XDsp convolution

If Q4 shows a clean fallback, refusal can stay as the permanent, documented behaviour. If it does
not, implement CPU convolution: uniformly partitioned FFT overlap-save with 1024-frame blocks,
behind the documented XDspActivate/XDspSubmitCommand/status-block contract. A dry pass-through
is a stopgap, not done.

Phase 6: Remove the flag

The touch list:

  • src/startup_stubs/{acphal,xapu,chad}.cpp
  • tests/startup_acphal_apu_free.cpp, tests/startup_xapu_queue_check.cpp,
    tests/startup_chad_check.cpp
  • tools/startup/run.ps1
  • docs/wine.md
  • three places in docs/startup-runtime.md: the switch table, "Audio output" and "APU heap
    stand-in"

Each test's "flag unset → trap" arm becomes an "export not reached or not implemented → trap" arm,
for example AcpHalReleaseShapeContexts. Each test's implemented-path checks keep their own
negative control.

Coordination

Item State Relevance
#1145 Open, owner's audio tracking issue Phases 2 to 4 report here. triggered02 owns timing and validation, and offered to take the XMA decode path. Ask before claiming a slice.
#1887 Open, opened by NiiRoZz Phase 1. #1907 closed the XDsp rows; the rest are open.
#1902 Open PR, Asimmimx Touches acphal.cpp; avoid conflicting edits.
#1536 Open draft, triggered02 Real-XAudio2 endpoint validation through process loopback.
#870 Open, P0 Its audio section lists the slices claimed by others (ACP memory, XApu/XDsp queue, acphal).

The owner assigns narrow, source-built, evidence-backed slices. Claim one on the issue before
starting it.

Suggested order

  1. Phase 0 capture and Q1 to Q5. This is local work; the only public output is aggregate findings.
  2. Phase 1 slices on #1887, one PR each.
  3. Phase 3 decisions (licence and fixture), raised on #1145 before any code.
  4. Phases 3 to 5 in the order the Phase 0 answers dictate, then Phase 6.

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7145645107 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1145#issuecomment-7145645107). Originally posted by [NiiRoZz](https://github.com/NiiRoZz) on 2026-11-24T21:58:58Z. --- Proposing a roadmap for replacing `X2W_AUDIO_PERMISSIVE` with a real implementation, so that the remaining slices here and on #1887 have an agreed order. Nothing below is implemented. Please redirect anything that conflicts with an existing track; I will claim individual slices here before starting any of them. Draft, 2026-11-24, against upstream `main` at `2a27507a`. This is a plan, not a measurement. Every "seen" below is one local observation unless a PR or issue is cited; layouts are observations, not facts. ### Goal and definition of done `X2W_AUDIO_PERMISSIVE` makes the three console audio stand-ins (`AcpHal.dll`, `xapu.dll`, `chad.dll`) accept calls they cannot serve, so startup continues with no console audio. The goal is to replace that with a real implementation. The flag is gone when all of these hold: 1. No `permissive()` branch is left in `acphal.cpp`, `xapu.cpp` or `chad.cpp`, and `run.ps1` no longer sets the flag. 2. Every export the title reaches either implements its contract, checked by a source-built caller, or returns a documented failure. For a documented failure, a run must show the title handles it. An export the title never reaches still traps. 3. A startup run's process-loopback capture ([startup-audio-timeline.md](https://github.com/R0Y00/Xbox2Windows/blob/main/docs/startup-audio-timeline.md)) shows non-silent audio in windows known to be audible. The #1508 pacing metric shows no stutter. 4. The three tests that use the flag's trap arm as a negative control keep an equivalent control (see Phase 6). No test is weakened or deleted. ### What the flag does today (upstream `main`) | Module | Under the flag | Without the flag | |---|---|---| | `AcpHal.dll` | Real heap: `ApuCreateHeap`, first-fit `ApuAlloc`/`ApuFree`, address map and validity. XMA shape contexts are allocated and cleared; other context types return `E_NOTIMPL`. The HAL object's slot 0 (connect) and slot 2 (submit) return `S_OK` and write nothing; other slots trap. | Traps | | `xapu.dll` | Handles are tracked. Each `XApuEnqueueCommand` queues one completion. `XApuDequeueResult` returns an all-zero 0x58-byte placeholder result. The 16-byte output of `XApuConnect` is never written. A 1 ms timer is held while connected (#1448). | Traps | | `chad.dll` | Connect validates its out-handle (#1871). `XDspActivate` clears its outputs and returns `XDSP_E_NO_DEVICE_RESOURCES`; submit refuses unknown handles (#1907). Deactivate and disconnect return 0 for any handle. | Traps | `AcpHalReleaseShapeContexts` traps in both modes. Nothing in the console path produces samples. The WASAPI sink (`audio_sink.{h,cpp}`, #1250) exists, but nothing feeds it. ### What is known about the title's audio path - **The audible output does not pass through the stand-ins.** In #1145, triggered02 reports that the title loads the system `XAudio2_9.dll` and an `AudioSes.dll` session. Speech is audible but stutters. The local video DLL also imports `XAudio2_9.dll` ordinal 1 ([experiments.md](https://github.com/R0Y00/Xbox2Windows/blob/main/docs/experiments.md)). - **The console path is used alongside it.** One local run saw these calls: - `ApuCreateHeap` with about 455 MiB cached and 2.2 MiB non-cached. - Shape-context counts `0,0,0,0,350,0`, so only XMA contexts are requested (350 × 64 bytes). - A HAL connect with two 4096-entry queues. - HAL submits of types 2 and 5; the type 5 submits used indices 0 to 14. - One `XApuConnect`, then type 1 and type 2 commands. The type 1 command holds `48000` at +0x38 and pointers. The fifth argument (`r9`) of the type 2 commands advances by about 0x100 per call. - XDsp convolution activations: type 1, 1024-frame blocks, mono, impulse responses of 40,960 to 208,896 floats. This was a local branch build; on `main`, activation is refused. - **The first 24 calls are all we have.** Logging is capped (`first_calls(calls, 24)`), so the command-type list is incomplete. - **The two runs disagree.** triggered02 saw `AcpHal::submit` never called and fewer than 500 `XApuGetResultCount` polls in 130 s. The local run saw 48 submits. The builds or stages probably differ; this needs a recorded commit for each run. - **Desktop XAudio2 has no XMA decoder.** Any XMA content (XAudio2 voices or SHAPE contexts) is silent today. The title asks for 350 XMA contexts, so this is likely most of the missing audio. ### Open questions (Phase 0 answers these) | # | Question | Why it decides the plan | |---|---|---| | Q1 | Which source-voice formats does the title create on XAudio2 (PCM, ADPCM, xWMA, XMA2)? Do XMA2 voice creations fail on desktop, and how does the title react? | Decides whether XMA decode belongs behind XAudio2 or behind SHAPE. | | Q2 | Does the title fill the XMA shape contexts and submit them through the HAL? Where is the decoded PCM supposed to land: APU heap buffers, an XAudio2 voice, or XApu? | Decides the SHAPE emulation scope. | | Q3 | What do XApu command types mean, which result types (1 to 5) does the caller's switch consume, and what does it read at +4 and +0x34? | Without this the queue cannot be implemented truthfully. | | Q4 | After `XDSP_E_NO_DEVICE_RESOURCES`, does the title fall back cleanly (dry signal, no reverb) or lose sound? Partly answered: in one local run without a debugger, on a build with #1907's refusal, 8 activations were refused, no submit followed, there was no crash, and the title stayed alive several minutes into the main load. What it does with the sound is unmeasured. | Decides whether refusal is an acceptable permanent behaviour or convolution must be implemented. | | Q5 | What causes the stutter on the XAudio2 path? | Separate from the flag, but item 3 of the definition of done needs it. | #### Phases #### Phase 0: Evidence (blocks everything) - Run a full capture with the cap lifted. Record every stand-in call with its arguments across startup, menus and gameplay, plus the commit and build of the run. Do this locally and publish aggregates only. - Do a static analysis of the callers: the XApu result switch, the HAL submit sites, the XMA context writes, and the XAudio2 `CreateSourceVoice` format arguments. Keep this local, with no dumps in issues or PRs. - Answer Q1 to Q5 with a recorded commit for each answer. - Measuring XAudio2 inside the title needs a logging boundary. The owner refused an IAT tap for the #1399 measurement and asked for explicit providers. Raise this on #1145 before building anything. #### Phase 1: Stand-ins that do not lie (rest of #1887) The remaining rows of #1887, one narrow PR each, each with a source-built caller and a negative control that fails when the old behaviour returns: - The `XApuConnect` 16-byte output: write it if the caller reads it, otherwise document that it does not (Q3). - `XApuDequeueResult`: replace the zero placeholder with measured fields, or fail. - AcpHal slot 0 and slot 2: write what the callers read back, or fail. - `XDspDeactivate` and `XDspDisconnect`: refuse null and unknown handles. #1902 is open on `acphal.cpp`. Wait for it to land or rebase on it. #### Phase 2: Audible-path pacing (#1145, triggered02's track) Find the stutter's root cause on the XAudio2 path with the existing controls (#1368, #1508, #1536). Fix the cause, not the buffer size. This phase does not touch the flag but blocks item 3 of the definition of done. #### Phase 3: XMA decode - Implement a software XMA2 decoder. Its placement follows Q1 and Q2: - **SHAPE emulation in `AcpHal`:** a worker processes the XMA contexts at the hardware frame cadence. It reads packets from the APU heap, writes PCM to the output buffers and posts completions to the HAL message queue. - **Behind XAudio2:** XMA2 source voices become PCM voices. This needs the owner's agreement on a provider in the XAudio2 path. They asked to keep the real provider and to evaluate a decoder or replacement provider separately. - Two decisions belong to the user and the owner: - **Licence.** The project is MIT. FFmpeg's XMA/WMA Pro decoder is LGPL, and the external provider named in #870 is GPL. The options are a clean-room MIT decoder or an optional, separately loaded provider. - **Fixture source.** There is no public XMA encoder. NinosTech's decode oracle on #1145 matched FFmpeg on a generated stream; ask how that stream was produced and under what licence. #### Phase 4: XApu command queue Implement the commands decoded in Q3. Results carry measured fields and complete at a measured cadence, driven by the audio clock (`IAudioClock` consumption) rather than at enqueue time. If XApu carries final PCM, route it to `audio_sink`. Otherwise it stays a control channel. #### Phase 5: XDsp convolution If Q4 shows a clean fallback, refusal can stay as the permanent, documented behaviour. If it does not, implement CPU convolution: uniformly partitioned FFT overlap-save with 1024-frame blocks, behind the documented `XDspActivate`/`XDspSubmitCommand`/status-block contract. A dry pass-through is a stopgap, not done. #### Phase 6: Remove the flag The touch list: - `src/startup_stubs/{acphal,xapu,chad}.cpp` - `tests/startup_acphal_apu_free.cpp`, `tests/startup_xapu_queue_check.cpp`, `tests/startup_chad_check.cpp` - `tools/startup/run.ps1` - `docs/wine.md` - three places in `docs/startup-runtime.md`: the switch table, "Audio output" and "APU heap stand-in" Each test's "flag unset → trap" arm becomes an "export not reached or not implemented → trap" arm, for example `AcpHalReleaseShapeContexts`. Each test's implemented-path checks keep their own negative control. ### Coordination | Item | State | Relevance | |---|---|---| | #1145 | Open, owner's audio tracking issue | Phases 2 to 4 report here. triggered02 owns timing and validation, and offered to take the XMA decode path. Ask before claiming a slice. | | #1887 | Open, opened by NiiRoZz | Phase 1. #1907 closed the XDsp rows; the rest are open. | | #1902 | Open PR, Asimmimx | Touches `acphal.cpp`; avoid conflicting edits. | | #1536 | Open draft, triggered02 | Real-XAudio2 endpoint validation through process loopback. | | #870 | Open, P0 | Its audio section lists the slices claimed by others (ACP memory, XApu/XDsp queue, acphal). | The owner assigns narrow, source-built, evidence-backed slices. Claim one on the issue before starting it. ### Suggested order 1. Phase 0 capture and Q1 to Q5. This is local work; the only public output is aggregate findings. 2. Phase 1 slices on #1887, one PR each. 3. Phase 3 decisions (licence and fixture), raised on #1145 before any code. 4. Phases 3 to 5 in the order the Phase 0 answers dictate, then Phase 6. AI-assisted (Claude Code).
NiiRoZz commented 2026-11-24 23:03:41 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by NiiRoZz on 2026-11-24T22:52:08Z.


Correction to my roadmap comment above, after a local static read of the main executable's imports, strings and call sites. Nothing here is a run measurement unless stated.

Wrong in the roadmap:

  • The 48000 at +0x38 and the advancing fifth argument (r9) of XApuEnqueueCommand are not fields. The title calls XApuEnqueueCommand(handle, command, 0) with three arguments. Its commands are 12 to 64 bytes long, so the logged bytes past them and the r9 value were stack and register leftovers.
  • The question about which formats the title creates on XAudio2 (Q1) is moot. The main executable imports nothing from XAudio2_9.dll and contains no XAudio2 string, in ASCII or UTF-16. Of the modules in the package, only the video DLL imports it (ordinal 1). XAudio2 output during a run is therefore most likely movie audio, not the game engine's.

New findings:

  • The main executable contains the GUIDs (from the Windows SDK 10.0.26100 headers) of these interfaces, and not IAudioRenderClient:

    • MMDeviceEnumerator, IMMDeviceEnumerator and IMMNotificationClient
    • IAudioClient
    • ISpatialAudioClient and ISpatialAudioObjectRenderStream

    The engine most likely renders through Windows spatial audio, which also exists on desktop. A run has not confirmed this yet.

  • XApu, read from the command builders, is a decoder-slot queue.

    • Type 1 opens a slot, type 2 closes it, type 5 resets it.
    • Type 3 decodes one packet. It carries the input pointer and size, 960 frames, a rate stored as a float, and an output buffer sized as channels × 960 × 4 bytes.
    • The codec is not identified.
  • Results drive a per-slot state machine. The title's result handler reads a type at +0, a slot at +4 and a value at +0x34. A slot advances only when the result type matches the command it waits on. The current all-zero placeholder result (type 0) matches no case, so no slot should become ready and no type 3 command should be sent. That is an inference from code: the earlier logs were capped at 24 calls, and an uncapped capture is in progress to check it.

Roadmap changes:

  • Q1 becomes "does the spatial audio stream render on desktop".
  • The XAudio2-side placement for XMA decoding is dropped; XMA stays inside the AcpHal/SHAPE path.
  • The XApu phase is rewritten around the slot protocol above.
  • The stutter work on this issue stays as it is. It now concerns the video DLL's audio.

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7146738268 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1145#issuecomment-7146738268). Originally posted by [NiiRoZz](https://github.com/NiiRoZz) on 2026-11-24T22:52:08Z. --- Correction to my roadmap comment above, after a local static read of the main executable's imports, strings and call sites. Nothing here is a run measurement unless stated. **Wrong in the roadmap:** - **The 48000 at +0x38 and the advancing fifth argument (`r9`) of `XApuEnqueueCommand` are not fields.** The title calls `XApuEnqueueCommand(handle, command, 0)` with three arguments. Its commands are 12 to 64 bytes long, so the logged bytes past them and the `r9` value were stack and register leftovers. - **The question about which formats the title creates on XAudio2 (Q1) is moot.** The main executable imports nothing from `XAudio2_9.dll` and contains no XAudio2 string, in ASCII or UTF-16. Of the modules in the package, only the video DLL imports it (ordinal 1). XAudio2 output during a run is therefore most likely movie audio, not the game engine's. **New findings:** - The main executable contains the GUIDs (from the Windows SDK 10.0.26100 headers) of these interfaces, and not `IAudioRenderClient`: - `MMDeviceEnumerator`, `IMMDeviceEnumerator` and `IMMNotificationClient` - `IAudioClient` - `ISpatialAudioClient` and `ISpatialAudioObjectRenderStream` The engine most likely renders through Windows spatial audio, which also exists on desktop. A run has not confirmed this yet. - **XApu, read from the command builders, is a decoder-slot queue.** - Type 1 opens a slot, type 2 closes it, type 5 resets it. - Type 3 decodes one packet. It carries the input pointer and size, 960 frames, a rate stored as a float, and an output buffer sized as channels × 960 × 4 bytes. - The codec is not identified. - **Results drive a per-slot state machine.** The title's result handler reads a type at +0, a slot at +4 and a value at +0x34. A slot advances only when the result type matches the command it waits on. The current all-zero placeholder result (type 0) matches no case, so no slot should become ready and no type 3 command should be sent. That is an inference from code: the earlier logs were capped at 24 calls, and an uncapped capture is in progress to check it. **Roadmap changes:** - Q1 becomes "does the spatial audio stream render on desktop". - The XAudio2-side placement for XMA decoding is dropped; XMA stays inside the AcpHal/SHAPE path. - The XApu phase is rewritten around the slot protocol above. - The stutter work on this issue stays as it is. It now concerns the video DLL's audio. AI-assisted (Claude Code).
NiiRoZz commented 2026-11-25 01:02:08 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by NiiRoZz on 2026-11-25T00:46:31Z.


@R0Y00 Proper audio, as opposed to X2W_AUDIO_PERMISSIVE, needs two decoders. Both raise a licence question that is yours to decide, so I'm asking before opening any PR.

Where things stand. These are local prototypes on top of main at 2a27507a, not submitted.

  • XApu packet decoding. XApu is a slot-based packet decoder. Each packet is 960 frames at 48 kHz, decoded to float PCM, and the result value is the decoded byte count.
    • Every captured packet carries an Opus TOC byte: 20 ms CELT or hybrid frames, mono.
    • Decoded on its own, each packet shows a sound onset outside the spread of 200 controls with the same TOC byte and random content.
    • The prototype answers open, close and reset with {type, slot}. It returns the shared buffer from XApuConnect (an #1887 row) and decodes with libopus.
    • In a local run through the first-run screens, 175 decode commands were answered at about real-time cadence, with no crash. The screen sounds became audible to the person running it.
  • XMA through AcpHal/SHAPE. The title fills its 64-byte XMA contexts in the publicly documented Xbox 360 XMA context layout, and drives them with three HAL submits: start, stop, and consume output blocks.
    • The prototype runs those contexts with libavcodec's xma2 decoder.
    • It passes a source-built state-machine check.
    • It has not been checked in a run yet, because the first-run screens start no XMA voice.

What has to be decided. The project is MIT.

  1. Opus: libopus, BSD-3-Clause, compatible with MIT. How should it enter the build?

    • (a) Vendor a pinned release, with its COPYING, under a third-party folder.
    • (b) Use CMake FetchContent with a pinned URL and SHA-256. This needs network access at configure time.
    • (c) Make it an optional find_package(Opus), so the decode is compiled only when libopus is installed (for example from vcpkg) and the default build and CI are unchanged.

    Tests need no binary fixtures: they can encode known tones with libopus at test time, which is what the prototype's check does.

  2. XMA: no permissively licensed XMA2 decoder that I know of.

    • (a) FFmpeg's libavcodec (LGPL-2.1-or-later), loaded dynamically at run time from an FFmpeg the user provides. The project would ship no FFmpeg code or binaries, and the stand-in delay-loads the DLLs only when enabled. LGPL obligations then fall on whoever redistributes FFmpeg, not on this repository. This is what the prototype does.
    • (b) A clean-room MIT XMA2 decoder. XMA is based on WMA Pro, so this is a large effort, and it must not be derived from FFmpeg's source to stay clean.
    • (c) An optional external provider DLL with its own repository and licence, behind a small decode interface in the stand-in.

    There is no public XMA encoder, so a repository test can only cover the context state machine unless a licensed XMA sample is available.

My suggestion: 1(c) and 2(a), both off by default, so the default build and CI stay unchanged. Then land small slices:

  1. the XApu slot results and connect buffer;
  2. Opus decoding;
  3. the AcpHal XMA contexts;
  4. removing X2W_AUDIO_PERMISSIVE once every path it covers is real.

Which options would you accept?

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7148861826 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1145#issuecomment-7148861826). Originally posted by [NiiRoZz](https://github.com/NiiRoZz) on 2026-11-25T00:46:31Z. --- @R0Y00 Proper audio, as opposed to `X2W_AUDIO_PERMISSIVE`, needs two decoders. Both raise a licence question that is yours to decide, so I'm asking before opening any PR. **Where things stand.** These are local prototypes on top of `main` at `2a27507a`, not submitted. - **XApu packet decoding.** XApu is a slot-based packet decoder. Each packet is 960 frames at 48 kHz, decoded to float PCM, and the result value is the decoded byte count. - Every captured packet carries an Opus TOC byte: 20 ms CELT or hybrid frames, mono. - Decoded on its own, each packet shows a sound onset outside the spread of 200 controls with the same TOC byte and random content. - The prototype answers open, close and reset with `{type, slot}`. It returns the shared buffer from `XApuConnect` (an #1887 row) and decodes with libopus. - In a local run through the first-run screens, 175 decode commands were answered at about real-time cadence, with no crash. The screen sounds became audible to the person running it. - **XMA through AcpHal/SHAPE.** The title fills its 64-byte XMA contexts in the publicly documented Xbox 360 XMA context layout, and drives them with three HAL submits: start, stop, and consume output blocks. - The prototype runs those contexts with libavcodec's `xma2` decoder. - It passes a source-built state-machine check. - It has not been checked in a run yet, because the first-run screens start no XMA voice. **What has to be decided.** The project is MIT. 1. **Opus: libopus, BSD-3-Clause, compatible with MIT.** How should it enter the build? - (a) Vendor a pinned release, with its `COPYING`, under a third-party folder. - (b) Use CMake `FetchContent` with a pinned URL and SHA-256. This needs network access at configure time. - (c) Make it an optional `find_package(Opus)`, so the decode is compiled only when libopus is installed (for example from vcpkg) and the default build and CI are unchanged. Tests need no binary fixtures: they can encode known tones with libopus at test time, which is what the prototype's check does. 2. **XMA: no permissively licensed XMA2 decoder that I know of.** - (a) **FFmpeg's libavcodec (LGPL-2.1-or-later), loaded dynamically at run time** from an FFmpeg the user provides. The project would ship no FFmpeg code or binaries, and the stand-in delay-loads the DLLs only when enabled. LGPL obligations then fall on whoever redistributes FFmpeg, not on this repository. This is what the prototype does. - (b) A clean-room MIT XMA2 decoder. XMA is based on WMA Pro, so this is a large effort, and it must not be derived from FFmpeg's source to stay clean. - (c) An optional external provider DLL with its own repository and licence, behind a small decode interface in the stand-in. There is no public XMA encoder, so a repository test can only cover the context state machine unless a licensed XMA sample is available. **My suggestion:** 1(c) and 2(a), both off by default, so the default build and CI stay unchanged. Then land small slices: 1. the XApu slot results and connect buffer; 2. Opus decoding; 3. the AcpHal XMA contexts; 4. removing `X2W_AUDIO_PERMISSIVE` once every path it covers is real. Which options would you accept? AI-assisted (Claude Code).
R0Y00 commented 2026-11-25 01:02:09 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T00:52:19Z.


For Opus, go with 1(c): an explicitly enabled optional system dependency discovered by CMake (find_package). Keep the default configure and current CI independent of libopus. Start with the connect buffer and slot lifecycle as its own PR, then test actual decoding in the optional build with generated tones, exact decoded byte counts, a malformed packet, and a guard that verifies untouched output on refusal. Document the tested libopus version and preserve its notices. Report the audible prototype as a local observation. Opus license

For XMA, accept the source-built context state machine first, behind an internal decoder boundary with a test provider. Keep libavcodec out of the in-tree build and distribution for this slice. If the state-machine evidence holds, 2(c) is the integration direction: a separate opt-in provider reviewed with its own licensing, version and provenance. FFmpeg's license depends on its build options, so dynamic loading alone isn't enough information to settle a distribution decision. Use only generated or appropriately licensed sample data for decoder tests. Keep the existing permissive mode until the real paths have separate coverage. FFmpeg licensing notes

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7148975813 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1145#issuecomment-7148975813). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-25T00:52:19Z. --- For Opus, go with 1(c): an explicitly enabled optional system dependency discovered by CMake (`find_package`). Keep the default configure and current CI independent of libopus. Start with the connect buffer and slot lifecycle as its own PR, then test actual decoding in the optional build with generated tones, exact decoded byte counts, a malformed packet, and a guard that verifies untouched output on refusal. Document the tested libopus version and preserve its notices. Report the audible prototype as a local observation. [Opus license](https://opus-codec.org/license/) For XMA, accept the source-built context state machine first, behind an internal decoder boundary with a test provider. Keep libavcodec out of the in-tree build and distribution for this slice. If the state-machine evidence holds, 2(c) is the integration direction: a separate opt-in provider reviewed with its own licensing, version and provenance. FFmpeg's license depends on its build options, so dynamic loading alone isn't enough information to settle a distribution decision. Use only generated or appropriately licensed sample data for decoder tests. Keep the existing permissive mode until the real paths have separate coverage. [FFmpeg licensing notes](https://ffmpeg.org/legal.html)
R0Y00 commented 2026-11-25 13:01:00 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T12:47:42Z.


#2326 landed at eda7cc3c. The optional build with libopus 1.5.2 passed both source-built tests in Windows Release, and the default build without libopus passed the queue regression. The new controls confirmed that malformed input and insufficient output capacity leave the output and completion queue unchanged on an active slot. The next packet matched the reference stream.

The next evidence for this issue is a playback run with the merged build. Record the build SHA, decoded completion count and accepted desktop audio submissions over a short reproducible window. This issue remains open for application output and the separate XMA path. Test command and result

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7162867052 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1145#issuecomment-7162867052). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-25T12:47:42Z. --- #2326 landed at eda7cc3c. The optional build with libopus 1.5.2 passed both source-built tests in Windows Release, and the default build without libopus passed the queue regression. The new controls confirmed that malformed input and insufficient output capacity leave the output and completion queue unchanged on an active slot. The next packet matched the reference stream. The next evidence for this issue is a playback run with the merged build. Record the build SHA, decoded completion count and accepted desktop audio submissions over a short reproducible window. This issue remains open for application output and the separate XMA path. [Test command and result](https://github.com/R0Y00/Xbox2Windows/pull/2326#issuecomment-7162687962)
SimSalabimse commented 2026-11-27 00:07:25 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by SimSalabimse on 2026-11-27T00:07:25Z.


Playback run on main 6ee878d8, built with -DX2W_WITH_OPUS=ON (libopus 1.5.2) and X2W_XAPU_TYPED_COMPLETIONS=1, on the test PC (RTX 4070 Ti).

Type-3 Opus completions succeed. The logged burst is 48 kHz, 960 frames, mono float (3840-byte output). The first 24 enqueue calls (one type-1 open, then 23 type-3 packets, all slot 0) all returned S_OK, with 0 opus errors. Enqueue logging is capped at 24 calls, so a full-run decoded completion count is not available from this log. Audio is audible through the title's real XAudio2_9. The desktop WASAPI sink is not on that path, so there are no accepted submissions from that sink to report.

Speech stutters, and it drifts from the subtitles.

At the scene where the title starts XMA / AcpHal type-5 submits and XDspActivate is refused (XDSP_E_NO_DEVICE_RESOURCES), the picture also drops to 2–8 fps. The same drop appears on this SHA without Opus. XMA and XDSP are still missing.

AI-Assisted

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7206189951 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1145#issuecomment-7206189951). Originally posted by [SimSalabimse](https://github.com/SimSalabimse) on 2026-11-27T00:07:25Z. --- Playback run on `main` `6ee878d8`, built with `-DX2W_WITH_OPUS=ON` (libopus 1.5.2) and `X2W_XAPU_TYPED_COMPLETIONS=1`, on the test PC (RTX 4070 Ti). Type-3 Opus completions succeed. The logged burst is 48 kHz, 960 frames, mono float (3840-byte output). The first 24 enqueue calls (one type-1 open, then 23 type-3 packets, all slot 0) all returned `S_OK`, with 0 opus errors. Enqueue logging is capped at 24 calls, so a full-run decoded completion count is not available from this log. Audio is audible through the title's real `XAudio2_9`. The desktop WASAPI sink is not on that path, so there are no accepted submissions from that sink to report. Speech stutters, and it drifts from the subtitles. At the scene where the title starts XMA / AcpHal type-5 submits and `XDspActivate` is refused (`XDSP_E_NO_DEVICE_RESOURCES`), the picture also drops to 2–8 fps. The same drop appears on this SHA without Opus. XMA and XDSP are still missing. AI-Assisted
R0Y00 commented 2026-11-28 04:12:30 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-28T04:12:30Z.


#2107 is on main at dbb1c9aa. The opt-in X2W_AUDIO_PERMISSIVE=1 plus X2W_AUDIO_ACTIVITY=1 path now reports XMA context transitions and XApu command counts. Native Windows source-built checks passed in Release with the default build and in Debug and Release with libopus 1.5.2. The Opus control detects an uncounted short type-3 command; turning the opt-in off preserves the guest-facing results.

This leaves #1145 open. The new evidence is from stand-in fixtures. For a later matched startup measurement, report the aggregated audio counts and whether playback was observed. Verification and exact commands.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7233805414 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1145#issuecomment-7233805414). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-28T04:12:30Z. --- #2107 is on main at `dbb1c9aa`. The opt-in `X2W_AUDIO_PERMISSIVE=1` plus `X2W_AUDIO_ACTIVITY=1` path now reports XMA context transitions and XApu command counts. Native Windows source-built checks passed in Release with the default build and in Debug and Release with libopus 1.5.2. The Opus control detects an uncounted short type-3 command; turning the opt-in off preserves the guest-facing results. This leaves #1145 open. The new evidence is from stand-in fixtures. For a later matched startup measurement, report the aggregated audio counts and whether playback was observed. [Verification and exact commands](https://github.com/R0Y00/Xbox2Windows/pull/2107).
Leyukaka commented 2026-11-29 15:25:59 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-29T15:25:59Z.


Proposal: log the XDspActivate parameter block before choosing between the refusal and a CPU convolution (Phase 5)

On main at 5de0b114, XDspActivate (src/startup_stubs/chad.cpp) clears both outputs and returns XDSP_E_NO_DEVICE_RESOURCES (0x8AC810A2). It logs the two output pointers but not the activation parameters (second argument), so a run on main does not show which effects the application requests.

One long local run with X2W_AUDIO_PERMISSIVE=1, read from the stand-in log lines:

  • XDspActivate was called 6 times, from one call site, with identical arguments each time.
  • No XDspSubmitCommand, XDspDeactivate or XDspDisconnect followed.
  • The run continued after the refusals; it stopped about 30 s later at an unrelated point.

This is the same pattern as the Q4 note in the roadmap (refused activations, no submit, no stop), with a different count: 6 here, 8 there. The effect types and sizes requested are not visible in this log.

Proposed change, diagnostic only:

  • In XDspActivate, log a hex dump of a fixed number of bytes at the parameter pointer, probed with x2w_local::readable first; log unreadable for a bad pointer.
  • Return value and outputs unchanged: the refusal asked for in #1887 stays.
  • tests/startup_chad_check.cpp: a sentinel parameter block whose bytes must appear in the log line, a bad parameter pointer that must log without faulting, and the existing return-code and cleared-output checks kept.

Not covered: the parameter layout is not interpreted, no convolution, and Q4 (what the application does with the sound after the refusal) stays open. Dumps from an application run stay local; only aggregates would be reported here.

@NiiRoZz your roadmap mentions a local branch that captured the activation parameters (type 1, 1024-frame blocks, mono, impulse-response sizes). Does that capture already cover this, or do you plan to submit it? I will only open this PR if you are not doing it.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7258084676 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/1145#issuecomment-7258084676). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-29T15:25:59Z. --- **Proposal: log the `XDspActivate` parameter block before choosing between the refusal and a CPU convolution (Phase 5)** On `main` at `5de0b114`, `XDspActivate` (`src/startup_stubs/chad.cpp`) clears both outputs and returns `XDSP_E_NO_DEVICE_RESOURCES` (0x8AC810A2). It logs the two output pointers but not the activation parameters (second argument), so a run on `main` does not show which effects the application requests. One long local run with `X2W_AUDIO_PERMISSIVE=1`, read from the stand-in log lines: - `XDspActivate` was called 6 times, from one call site, with identical arguments each time. - No `XDspSubmitCommand`, `XDspDeactivate` or `XDspDisconnect` followed. - The run continued after the refusals; it stopped about 30 s later at an unrelated point. This is the same pattern as the Q4 note in the roadmap (refused activations, no submit, no stop), with a different count: 6 here, 8 there. The effect types and sizes requested are not visible in this log. Proposed change, diagnostic only: - In `XDspActivate`, log a hex dump of a fixed number of bytes at the parameter pointer, probed with `x2w_local::readable` first; log `unreadable` for a bad pointer. - Return value and outputs unchanged: the refusal asked for in #1887 stays. - `tests/startup_chad_check.cpp`: a sentinel parameter block whose bytes must appear in the log line, a bad parameter pointer that must log without faulting, and the existing return-code and cleared-output checks kept. Not covered: the parameter layout is not interpreted, no convolution, and Q4 (what the application does with the sound after the refusal) stays open. Dumps from an application run stay local; only aggregates would be reported here. @NiiRoZz your roadmap mentions a local branch that captured the activation parameters (type 1, 1024-frame blocks, mono, impulse-response sizes). Does that capture already cover this, or do you plan to submit it? I will only open this PR if you are not doing it.
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows#1138
No description provided.