Ramp a changed volume across the audio frame instead of applying it at once.

The mixer applied each voice's mix volume and each splitter destination's
volume to a whole 5 ms frame as one constant, so the level jumped at the
frame's first sample whenever the game moved a volume, which is heard as a
click. It now keeps what each voice and each splitter destination was mixed
with in the frame before and goes from there to the new value in equal steps
across the frame's samples, as the console's renderer does. An unchanged
volume stays on the constant path.

A voice that has just started, one that was silent in the frame before or was
moved to another mix or splitter, a destination that is new or was moved, and
the first frame after the renderer starts take the new volume at once.

NX2NAVI_AUDIO_RAMP=0 turns the ramps off. The audio statistics line counts the
render passes that ramped a volume. tests/audio_mixer_check.py builds the
mixer with the rest of the runtime stubbed and checks the ramps and the cases
that must not ramp.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-12 15:10:29 -05:00
parent 202fd47ceb
commit 42d16e7f0b
8 changed files with 476 additions and 10 deletions

View File

@@ -713,6 +713,10 @@
# Host priority of the game's audio thread: 0 leaves it alone, 1 raises it to the highest while its audio update is
# read (the audio render thread waits for that), 2 also keeps it above normal. Takes effect at the next start.
# audio_game_prio = 0
# When the game changes a sound's volume, go from the old volume to the new one across the 5 ms of sound that follow,
# as the console does (1, the default). 0 applies the new volume at once, which clicks when a volume moves quickly (a
# fade, a sound passing by). Takes effect at the next start.
# audio_ramp = 1
# Volume in percent (0 to 100), on top of the game's own. Changes while the game runs take effect at once.
# volume = 100
# Speakers: stereo, 5.1 or auto (5.1 when the Windows speaker setup has six or more channels, stereo otherwise). The