Repository navigation
Conversation
Windows wakes a sleeping thread on its 15.6 ms tick unless the process asks for a finer timer. The retail game's audio mixer sleeps between 5.33 ms chunks, so it made one chunk per tick, a third of real time: measured on its spatial audio stream, sound in 34 % of the device's 10 ms passes and silence in the rest. With the finest timer (0.5 ms), every pass has sound. Windows 11 keeps it while the window is hidden only when the process opts out of power throttling. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Independent native Windows/NVIDIA validation of #300 at Tested
Separate before/after probe, using the actual PR function
This reproduces a shorter wait after the timer request on this host. The before values are the measured 7-8 ms, not assumed to equal the queried 15.62 ms system resolution. This does not measure audio quality, mixer continuity, or game performance. SKIPPED / Not tested AI use |
|
Can confirm this fixes the choppy audio problem on my RTX 4070 Super system, no idea if this is the best solution though |
|
Independent static code & Win32 API audit of Summary: Clean and matches Windows API semantics
Two small notes
(AI-assisted — Gemini 4 Neon) Update: Windows 11 / RTX 5080 test run on
|
|
Data point on the intro slow stretch (our machine: RTX 3060 Ti 8 GB, Ryzen 7 9800X3D, driver 32.0.16.1742): the retail title's artwork intro runs at ~4.4-8.6 fps for roughly t=45-165 s, then a steady 30 fps. We measured the same dip with and without this PR + #294 in the stack (same graphics PRs otherwise, XCL_NETWORK=0, XCL_ACTIVITY=1):
So the dip is not the audio path on this hardware - noting it so nobody chases the timer / Opus work for it. In the no-audio run during the dip (t=90 s): 15252 MB committed by the process, video memory 6515 MB local + 4619 MB non-local on the 8 GB card, 3231 MB of target pages; by t=178 s it is 17071 MB / 7791 MB local. DXC compiles are all cache hits there (dxil_cache 25 hits, 0 misses). It looks like memory pressure and streaming, not compilation. Separately, a 600 s run on an older stack (main 4017f8f + #300 + #294 + #273/+#208 + #283/+#252, before #283 was merged) reached the character loading screen and then crashed at t=395 s with 0xc0000005 (write at 0xc43440110, game+0x35a47bc) at ~26.6 GB of commit - past the loading screen, so probably unrelated to this PR. AI use: GPT-6.2 Astra (API model selector) ran the builds/runs and wrote this report; the human contributor watched the runs. |
|
First AMD run: the sound plays cleanly with this PR. Setup: AMD Radeon RX 9060 XT 16 GB (RDNA4), driver 32.0.31044.16; Ryzen 5 5600, 32 GB; Windows 11 Pro 26300; release. Build:
Not tested / not attributed: the run ended at 161 s with AI use: Claude Code with Claude Opus 5.5 read the run's log and wrote this report from my run; the listening is mine. |
Fixes #260.
The choppy sound in the retail GTA VI is not the audio processor: the game mixes on the CPU and plays through Windows spatial audio (
ISpatialAudioClient, two static objects, 48 kHz float), and that stream was fed on time but with sound in only 34 % of its 10 ms passes. The mixer sleeps between 5.33 ms chunks, and without a finer timer Windows wakes it on its 15.6 ms tick, so it made a third of real time (5.33 / 15.6 = 34 %). XCL now asks for the finest timer Windows offers (0.5 ms) at start, and opts out of the Windows 11 power throttling that drops it while the window is hidden. With it every pass has sound.What is in it
kernelx::fine_timer(crates/xcl/src/hle/kernelx.rs):NtSetTimerResolutionto the finest resolutionNtQueryTimerResolutionreports,SetProcessInformation(ProcessPowerThrottling, IGNORE_TIMER_RESOLUTION), onetimer:log line; testfine_timer_makes_short_sleeps_short(20 × WindowsSleep(1), average under 5 ms: 15.4 ms without the fix, fails; passes with it)host_mainafterhle::init(crates/xcl/src/host.rs)Tested
cargo test --workspace --release -- --test-threads=4: 652 passed, 0 failed, 40 ignored (SKIPPED:gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware– no wave64)RockstarGamesInc.28872443D20A71.0.2.1),XCL_NETWORK=0: the menu's sound is continuous instead of choppy. Measured with temporary logging on the game's spatial audio stream (not in this PR): before, sound in 172 of 500 passes per 5 s, evenly spread; after, 500 of 500 once the sound starts.Regression run
main:
PR:
5 frames fewer over 60 s (0.3 %) at the same rate at the end; one run each, so within run-to-run noise.
Not tested
AI use