audio: opt-in loudness equalization of the title's Spatial Audio output (VICTORY_LOUDNESS_EQ) #95
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/ReTerryDavis--ReVIctory!95
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-94"
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?
@rgroenewoudt on GitHub · 2026-12-05 11:08 UTC · original
rgroenewoudt:loudness-equalization→main· +1213 −16 · 7 files · 7 commits · openTitle has lower audio volume compared to other PC applications/games. Add loudness equalization to add small gain without clipping louder sounds like explosions.
Summary
Opt-in loudness equalization for the title's Spatial Audio output. Quiet sound is raised by up to +2 / +4 / +6 dB (
low/medium/high). Loud sound is not raised, and peaks stay under -1 dBFS. It is off by default.Where it hooks in (only when
VICTORY_LOUDNESS_EQis set):What the leveler does on each update:
Every object in an update gets the same gain, so the spatial balance between objects stays the same.
Launcher and script:
scripts/play.ps1 -LoudnessEq low|medium|highsets the same env var.Evidence
After (
-LoudnessEq medium, ~170 s of play including a loud scene of about a minute):loudness eqlinescargo test -p victory-hle loudness_eq: 14 pass, including:Releasedrops the levelercargo test -p victory launcher: 25 pass. This includesthe_settings_are_those_of_the_script, which ties the launcher toplay.ps1.Merge Danger
Door: two-way
Off by default: with
VICTORY_LOUDNESS_EQunset, theCoCreateInstanceimport is left alone. The only lasting trace is aloudness_eqkey inlauncher.txt, which older launchers ignore.Blast Radius: audio
When it is on, it patches vtable slots of process-wide COM classes (
IMMDevice::Activate, the Spatial Audio stream and object vtables). Only Spatial Audio streams of F32 or 16-bit PCM are scaled, and the haptics path (IAudioClient) is not touched. I tested it on one machine only (AMD, a 12-object F32 stream). The Settings → Game layout also changed: the cache section moved down and the boxes are shorter. I checked it by eye in the launcher.The branch history starts with the fixed gain and then replaces it. Squash on merge if you want one commit.
@ReTerryDavis on GitHub · 2026-12-05 17:39 UTC · original
Really clean opt-in implementation and nice in-game verification! Marking as draft for one small thread-safety fix before merge:
VirtualProtectrace (crates/victory-hle/src/loudness_eq.rs,swap):Hook::installlocks only its ownHook, not a shared page-protect lock. SinceSTREAM_BEGIN_HOOK,STREAM_END_HOOK,STREAM_RELEASE_HOOK, andSTREAM_OBJECT_HOOKpatch vtable slots on the same.rdatapage, concurrent installs can have one thread restorePAGE_READONLYright before another'sAtomicUsize::swap, causing an access violation. Guardingswap()with a single staticMutex<()>closes that cleanly.Once that's fixed, mark ready and it's good to merge!
9e087662eftod867437137View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.