Repository navigation
Conversation
…ENT-AUDIO-PASS-CADENCE) PeriodicThread waited for each pass with WaitForSingleObject and a timeout in milliseconds. On Windows a timeout ends on the system timer's tick, 15.625 ms for a process that has not raised the timer resolution, and nothing in the runtime does. The 10 ms period therefore woke once per tick: about 64 passes a second instead of 100. A spatial stream hands out 480 frames each pass, so the title, which activates ISpatialAudioClient first (docs/runtime_imports.md) and is paced by its event, rendered about 30,700 frames a second against 48,000: its audio clock ran at 64% of real time. The IAudioClient stream's event came at the same rate. The wait now uses a CREATE_WAITABLE_TIMER_HIGH_RESOLUTION timer, as the gameinput and d3d12_xs shims do, set to the next pass's due time, with the stop event beside it. Where the timer cannot be created, the timeout wait remains. Tested (Windows 11, MSVC 14.44): silent_audio_test records when each spatial pass's event arrives and checks the median gap of the nine after Start, unless the whole run took over 300 ms (a starved host, where the spacing says nothing about the timer). On main: 10 passes in 143 to 159 ms, median gap 15.6 to 17.2 ms, the check fails in 3 of 3 runs. With the fix: 10 passes in 90 ms, median gap 10.0 ms, all 130 checks pass in 3 of 3 runs. ctest -j 8 (162 CPU tests) passes apart from the system-commit check of xmem_test that ProjectLeonida#1316 addresses. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Claimed in the coordination issue as: SILENT-AUDIO-PASS-CADENCE (claim comment to follow)
What and why
runtime/shims/silent_audio.cppPeriodicThread::rundrives both silent streams' 10 ms passes. It waited for each pass withWaitForSingleObject(stop_, wait)and a timeout in whole milliseconds. On Windows a wait timeout ends on the system timer's tick: 15.625 ms for a process that has not raised the timer resolution, and nothing inruntime/does (notimeBeginPeriod/NtSetTimerResolution). The 10 ms period therefore woke once per tick, and the fixed schedule re-anchored after each late wake: about 64 passes a second instead of 100.The title activates
ISpatialAudioClientfirst (docs/runtime_imports.md), and the spatial stream hands out 480 frames per pass and signals its event once per pass. A title paced by that event rendered about 30,700 frames a second against 48,000: its audio clock ran at 64% of real time. TheIAudioClientstream's event came at the same rate (its padding is measured with QPC, so only its cadence was off).The wait now uses a
CREATE_WAITABLE_TIMER_HIGH_RESOLUTIONtimer set to the next pass's due time, with the stop event beside it inWaitForMultipleObjects, as the gameinput and d3d12_xs shims already do. Where the timer cannot be created, the timeout wait remains. It also ends the short busy spin the old loop did when less than 1 ms was left (waittruncated to 0).Tested
Windows 11, MSVC 14.44 (Build Tools), RelWithDebInfo:
silent_audio_testnow records when each spatial pass's event arrives and checks the median gap of the nine afterStart(8 to 12.5 ms), unless the whole run took over 300 ms: a host that starved the passes says nothing about the timer, so there the gaps are only printed.main: 10 passes in 143 to 159 ms, median gap 15.6 to 17.2 ms; the check fails in 3 of 3 runs.ctest -j 8(162 CPU tests) passes, apart fromxmem_test's system-wide commit check that tests: xmem commit-on-touch checks read the test's own view, not system commit (TEST-XMEM-COMMIT-CHECK) #1316 addresses.scripts/check_no_game_data.pyon both files.Not tested under Wine; there the high-resolution timer may be unavailable and the old wait stays in use.
GPUs tested: n/a (CPU tests)
AI-assisted: yes (Claude Code, Claude Opus 5.5)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)🤖 Generated with Claude Code