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

@@ -358,6 +358,14 @@ frame, uneven frame times one steady step, and game time follows the clock. It c
sites do: at 144 fps each of 64 water objects gets its ripple steps and the day its seconds, and a step of one frame
gives what the game computes. No game files.
A change to how the mixer applies volumes (`runtime/audio_mixer.c` `accumulate_ramp`, the voice and splitter paths
of `audio_mixer_render`) passes `python tests\audio_mixer_check.py`, which builds `audio_mixer.c` with the rest of
the runtime stubbed and mixes voices of one constant sample, so a mix buffer shows the gain sample by sample: a
volume stepped from 0 to 1 rises in equal steps across the next 5 ms frame and holds after it, for a voice into a mix,
a voice into a splitter destination and a submix into one; a voice that starts, was silent in the frame before or was
moved to another mix, 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` applies every volume at once. No game files and no audio device.
A change to the mouse camera (`runtime/mouse_direct.c`, the mouse path of `runtime/input.c`, the set `mouse_direct` of
`recomp/patches-v111.txt` or `patches-v143.txt`) passes `python tests\mouse_direct_check.py --cc <clang> --deps
<ucrt64>\include`, which builds `mouse_direct.c`, and `input.c` with `--deps`, with the rest of the runtime stubbed and