WIP: fix(sound): above 60 fps the sound effects no longer go silent after a minute or two #3308
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/mods
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!3308
Loading…
Reference in a new issue
No description provided.
Delete branch "llun/Longshot:fix/sound-engine-60hz-high-fps"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Above a Game frame rate cap of 60, the sound effects and voices go silent a minute or two after loading a save. The music keeps playing, then it can stop too (the Forest Temple). A player at a 240 cap (about 200 to 220 fps, RTX 5090) hit it on Nightly 1179 and Nightly 1217. At a cap of 60 it never happened, with or without their one sound mod.
What their log showed (
HOS_AUDIO_STATS=1,HOS_FPS_LOG=1):Why. Since #2983 (the Lens of Truth's on and off sounds above 60 fps), phase 0 of the sound job (
f_80435300) runs on every frame. On a frame the 60 Hz gate holds, it gets a step of 0, but every module and the sound system's update (f_8012f9c0) still run. That update counts its own calls and hands work to the audio thread. At 220 fps it ran about 220 times a second against the renderer's 200 audio frames a second, and the voices stopped being retired.What this changes. On a frame the gate holds, phase 0 now:
EVENT_CUE_VTABLE; itsvt+0x30,f_80ac6780, starts the Lens's on and off cues), so the Lens fix stays;f_80435860through a new jump site,sound.systemUpdate.Everything else runs once a whole 60 fps step, as at a cap of 60. A cap of 60 is unchanged: no frame is held there.
How to see it on main: set the Game frame rate cap to 240 on a PC that reaches 200 fps or more, load a save and play for a few minutes (the Forest Temple, the Temple of Time and the Market all showed it). The sound effects stop. With
HOS_AUDIO_STATS=1the "voices started" line freezes.Read first:
game/crates/game-core/src/fixes/high_fps.rs;sound_module_held_ruleandsound_system_held_rule;sound.systemUpdateingame/sites/sites.toml.The cause was narrowed with two agents arguing opposite fixes. Delta time, as the cloth fix (#3242) does, was ruled out: it would still update the sound engine at the frame rate.
Testing
Tested: Windows 11, RTX 5080, NVIDIA 621.47, headless runs through the job queue.
a_held_frame_leaves_the_sound_engine_and_its_modules_to_the_next_runinhigh_fps.rs, fails on the test commit as on main: "120 fps: the sound system updated 1200 times for 600 whole steps". It passes with the fix at 120, 144, 165, 200, 240, 360 and 480 fps and at a cap of 60.game-corepass.cargo test -p sitespasses, including the site owners.sound.systemUpdateinf_80435860beside the two module sites (the work folder'sgen/edits.txt).dev.py smokepasses (kokiri-start, in play, menu opened). A 4-minute run uncapped in Handheld, Link walking, rolling and swinging between the Market and Hyrule Field (about 77 fps there; the gate held about 1 frame in 5, so the skip ran): sounds kept starting (a voice started in 182 of 225 seconds ofHOS_AUDIO_STATS), and no finished voice stayed started for more than a second, as at a cap of 60.Still to test:
HOS_AUDIO_STATS=1andHOS_FPS_LOG=1inlongshot_env.txt. Expect sound effects and voices to keep playing and the "voices started" counts to keep changing. (by hand, the reporter)HOS_AUDIO_STATS=1. Expect the "voices started" line to keep changing.Measurements
Nothing measured. This only removes calls on frames the gate holds, and it makes no performance claim.
Risks
f_80ac6780has the Lens's cue names. A revert brings back #2983's behaviour, and the freeze with it.Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named). 887 passed, 14 failed, 55 skipped (Windows, 12 at once). None of the 14 reads a file this PR changes:test_lifterstops at a clippytype_complexityerror ingame/crates/api/src/settings/service.rsand theffi-gencheck, both from main;test_device_lost_exit,test_fps_stats,test_lost_wait_said,test_present_acquire_ahead,test_present_device_loss,test_present_thread,test_present_probe_retirement,test_present_probe,test_queue_priority,test_recorder_parts,test_submit_oom,test_sync_watch_eventandtest_stack_commitcheck the renderer and the host's memory, which this PR leaves alone.cargo clippy -p game-core -p sites --all-targets -- -D warningsandcargo fmt --checkare clean on the changed crates (the third commit is rustfmt's wrap of one assert in the test).main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
mainand passes here.Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.🤖 Generated with Claude Code
Tested in game: DO NOT MERGE: up for the reporter's test at a 240 cap. Windows 11, RTX 5080, NVIDIA 621.47, headless through the job queue, the two commits before their rebase onto
be4942212(same diff). dev.py smoke PASS (kokiri-start, in play, menu opened). About 4 minutes uncapped in Handheld between the Market and Hyrule Field (~77 fps, the gate holding ~1 frame in 5): sounds kept starting and no finished voice stayed started over a second. This PC can't reach the 200+ fps the freeze needs, so the fix itself is not yet shown working: that is the reporter's run in Still to test.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.