RT-SILENT-AUDIO-ENDPOINT: serve a silent output endpoint when the host has none (the boot's audio-lock stop) #1598

Manually merged
github merged 2 commits from gh-pr/1598/head into gh-pr/1598/base 2026-11-26 09:57:40 +00:00
Owner

@⁠aslan2142 on GitHub · 2026-11-25 05:31 UTC · original
aslan2142:silent-audio-endpoint → main · +2163 −2 · 8 files · 2 commits · merged 2026-11-25 05:32 UTC

Item: RT-SILENT-AUDIO-ENDPOINT. The claim could not be posted: coordination issue #14 is at GitHub's 2,500-comment limit and has no successor yet. The claim text, to be copied there once there is one:

claiming: RT-SILENT-AUDIO-ENDPOINT - when the host has no audio output, CoCreateInstance(MMDeviceEnumerator) answers render questions with an in-process silent output endpoint (and LEONIDA_AUDIO=silent forces it), so the title's audio start takes its console path

Searched first: no claim or open pull request covers this.

What and why

On a host with no audio output, the title's GetDefaultAudioEndpoint(eRender) returns 0x80070490. Its audio device start then takes an error path that leaves its output-device lock held, and the audio engine never mixes. A main-thread command buffer fills up, and the boot stops on an int3 about 47 s in. Refusing the enumerator altogether gives the same stop. A console always has an output.

Measured on the retail boot first, without code:

  • a diagnostic thread dump showed the engine thread waiting on a lock held by an idle job worker;
  • a private sound server with only a null sink, so still no sound, removed the stop.

CoCreateInstance(MMDeviceEnumerator) now goes to shims/silent_audio.cpp (hooked in shims/com_shim.cpp).

  • A host enumerator that has a render endpoint is returned unchanged.
  • Otherwise, or with the new LEONIDA_AUDIO=silent, render questions get an in-process endpoint that never opens a host device and throws every sample away. It serves:
    • ISpatialAudioClient/2, which is what the title activates: a 7.1 static bed, mono 48 kHz float objects, and an event every 10 ms;
    • IAudioClient/2/3 with render client, clock and volume services.
  • Capture keeps the host's answer.
  • One [rt] line names the reason.
  • Docs: the variable is in runtime/README.md, and the behaviour in docs/runtime_imports.md ("Audio output off the console (WASAPI)").
  • Not measured on a console: 7.1 as the mix format and a bed with 0 dynamic objects. Both are written down as hypotheses.

Tests

  • New silent_audio_test: 129 checks, using stand-in hosts, so no host audio is touched. It covers the enumerator with no endpoint, with one and with none at all; forced mode; event-driven, polled and spatial streams running on their clock; and the hook with LEONIDA_AUDIO=silent.
  • Red check: against main's com_shim.cpp, the hook checks fail.
  • Windows suite under Wine 11.22 (clang-cl build), llvmpipe and an RDNA2 iGPU (RADV): no test goes from pass to fail; silent_audio is new and passes on both.
  • Python checks: test_docs_env_vars, test_docs_links, test_docs_repo_paths, test_ci_registration and test_ctest_registration pass.

Measured on the retail boot

Wine, no audio driver at all, RDNA2 iGPU; counts only. Measured with #1539 merged locally, since RADV loses the device without it. It is not needed to build or merge this.

build run time end D3D12 calls presents
main 48 s the title's int3 about 112k 144
this branch 300 s (time limit) 0 exceptions 135k 367
this branch, LEONIDA_AUDIO=silent 300 s (time limit) 0 exceptions 135k 365

AI-assisted (Claude Code, Claude Opus 5.5).

**@⁠aslan2142** on GitHub · 2026-11-25 05:31 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1598) `aslan2142:silent-audio-endpoint` → `main` · +2163 −2 · 8 files · 2 commits · merged 2026-11-25 05:32 UTC Item: `RT-SILENT-AUDIO-ENDPOINT`. **The claim could not be posted:** coordination issue #14 is at GitHub's 2,500-comment limit and has no successor yet. The claim text, to be copied there once there is one: > claiming: RT-SILENT-AUDIO-ENDPOINT - when the host has no audio output, `CoCreateInstance(MMDeviceEnumerator)` answers render questions with an in-process silent output endpoint (and `LEONIDA_AUDIO=silent` forces it), so the title's audio start takes its console path Searched first: no claim or open pull request covers this. ### What and why On a host with no audio output, the title's `GetDefaultAudioEndpoint(eRender)` returns `0x80070490`. Its audio device start then takes an error path that leaves its output-device lock held, and the audio engine never mixes. A main-thread command buffer fills up, and the boot stops on an `int3` about 47 s in. Refusing the enumerator altogether gives the same stop. A console always has an output. Measured on the retail boot first, without code: - a diagnostic thread dump showed the engine thread waiting on a lock held by an idle job worker; - a private sound server with only a null sink, so still no sound, removed the stop. `CoCreateInstance(MMDeviceEnumerator)` now goes to `shims/silent_audio.cpp` (hooked in `shims/com_shim.cpp`). - **A host enumerator that has a render endpoint is returned unchanged.** - **Otherwise, or with the new `LEONIDA_AUDIO=silent`,** render questions get an in-process endpoint that never opens a host device and throws every sample away. It serves: - `ISpatialAudioClient`/`2`, which is what the title activates: a 7.1 static bed, mono 48 kHz float objects, and an event every 10 ms; - `IAudioClient`/`2`/`3` with render client, clock and volume services. - **Capture keeps the host's answer.** - **One `[rt]` line names the reason.** - **Docs:** the variable is in `runtime/README.md`, and the behaviour in `docs/runtime_imports.md` ("Audio output off the console (WASAPI)"). - **Not measured on a console:** 7.1 as the mix format and a bed with 0 dynamic objects. Both are written down as hypotheses. ### Tests - **New `silent_audio_test`:** 129 checks, using stand-in hosts, so no host audio is touched. It covers the enumerator with no endpoint, with one and with none at all; forced mode; event-driven, polled and spatial streams running on their clock; and the hook with `LEONIDA_AUDIO=silent`. - **Red check:** against `main`'s `com_shim.cpp`, the hook checks fail. - **Windows suite under Wine 11.22 (clang-cl build), llvmpipe and an RDNA2 iGPU (RADV):** no test goes from pass to fail; `silent_audio` is new and passes on both. - **Python checks:** `test_docs_env_vars`, `test_docs_links`, `test_docs_repo_paths`, `test_ci_registration` and `test_ctest_registration` pass. ### Measured on the retail boot Wine, no audio driver at all, RDNA2 iGPU; counts only. Measured with #1539 merged locally, since RADV loses the device without it. It is not needed to build or merge this. | build | run time | end | D3D12 calls | presents | |---|---|---|---|---| | `main` | 48 s | the title's `int3` | about 112k | 144 | | this branch | 300 s (time limit) | 0 exceptions | 135k | 367 | | this branch, `LEONIDA_AUDIO=silent` | 300 s (time limit) | 0 exceptions | 135k | 365 | AI-assisted (Claude Code, Claude Opus 5.5).
The title creates its MMDeviceEnumerator through CoCreateInstance. On a host with no
render endpoint, GetDefaultAudioEndpoint(eRender) is 0x80070490, the title's audio device
start leaves its own output-device lock held, the audio engine never mixes, and the boot
stops on an int3 about 47 s in. A console always has an output.

com_shim's CoCreateInstance now hands that class to shims/silent_audio.cpp. A host
enumerator with a default render endpoint is returned unchanged. Otherwise (no endpoint,
no enumerator, or LEONIDA_AUDIO=silent) render questions get an in-process endpoint:
IMMDevice with a read-only property store, IAudioClient/2/3 at 48 kHz float 7.1, and
IAudioRenderClient, IAudioClock, ISimpleAudioVolume and IAudioStreamVolume. A clock drains
the padding in real time and an event-driven stream's event is signalled every 10 ms.
Every sample is discarded; no host audio device is opened. Capture keeps the host's
answer. One [rt] line names the reason when the silent device is first served.

silent_audio_test covers stand-in hosts with and without an endpoint, no host, a render
stream over a few periods, and the CoCreateInstance hook with LEONIDA_AUDIO=silent.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The title activates ISpatialAudioClient on the render device, not IAudioClient (the first
game run with the silent endpoint logged that IID and stopped as before). The silent device
now answers ISpatialAudioClient and ISpatialAudioClient2: a 7.1 static bed, no dynamic
objects, mono 48 kHz float objects, 480 frames a pass. Its ISpatialAudioObjectRenderStream
signals the stream's event every 10 ms while it runs, and its objects write into a
scratch buffer. The periodic event thread is shared with IAudioClient.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:57:38 +00:00
github manually merged commit 018145b338 into gh-pr/1598/base 2026-11-26 09:57:40 +00:00
Author
Owner

@⁠aslan2142 on GitHub · 2026-11-25 05:32 UTC · original

Merged as a boot-blocker fix: on a host with no audio output, the retail boot now runs past the audio-lock stop at about 47 s (counts in the description).

  • Claim: RT-SILENT-AUDIO-ENDPOINT, in the description, because #14 is full.
  • Who it changes nothing for: hosts with an audio output keep their own enumerator unchanged. Capture always keeps the host's answer.
  • No sound, by construction: the silent endpoint never opens a host device. LEONIDA_AUDIO=silent forces it, for muted test runs.
  • Tests: Windows suite under Wine (llvmpipe and an RDNA2 iGPU), with nothing going from pass to fail; silent_audio_test is new; and a red check against main's com_shim.cpp.
  • Review welcome after the fact, in particular the 7.1 bed and the 0 dynamic objects, which are hypotheses (written down as such in docs/runtime_imports.md).
  • Checked on main c7e82e26e + 018145b33: it merges cleanly; the semantic suite passes (487 files, 6,279 tests, 0 files failed); the 14 docs and writer tests pass; check_no_game_data.py is clean on the 8 changed files.

AI-assisted (Claude Code, Claude Opus 5.5).

**@⁠aslan2142** on GitHub · 2026-11-25 05:32 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1598#issuecomment-7153876336) Merged as a boot-blocker fix: on a host with no audio output, the retail boot now runs past the audio-lock stop at about 47 s (counts in the description). - **Claim:** `RT-SILENT-AUDIO-ENDPOINT`, in the description, because #14 is full. - **Who it changes nothing for:** hosts with an audio output keep their own enumerator unchanged. Capture always keeps the host's answer. - **No sound, by construction:** the silent endpoint never opens a host device. `LEONIDA_AUDIO=silent` forces it, for muted test runs. - **Tests:** Windows suite under Wine (llvmpipe and an RDNA2 iGPU), with nothing going from pass to fail; `silent_audio_test` is new; and a red check against `main`'s `com_shim.cpp`. - **Review welcome after the fact,** in particular the 7.1 bed and the 0 dynamic objects, which are hypotheses (written down as such in `docs/runtime_imports.md`). - **Checked on `main` `c7e82e26e` + `018145b33`:** it merges cleanly; the semantic suite passes (487 files, 6,279 tests, 0 files failed); the 14 docs and writer tests pass; `check_no_game_data.py` is clean on the 8 changed files. AI-assisted (Claude Code, Claude Opus 5.5).
This discussion has been locked. Commenting is limited to contributors.
No description provided.