benilla-re systems structs docs

s_cutoffFadeFraction

global · sound

Address
0x81d728 · 4 bytes, up to 0x81d72b
Type
const float
Meaning
Holds 0.10000002, the fraction of the cutoff the distance gain fades over
Confidence
verified, proof one
Finding
sound/engine#distance-cutoff

Finding: Distance cutoff in sound: the engine

Sound::SetCutoffDistanceSquared(c) stores the distance c (not its square) for a 3D sound: 0 removes the sound from the cutoff list; otherwise it joins it, and a looped sound at or beyond c of the listener, or at a NaN distance, is paused under reason 3 and flagged cut off. Each frame, a listed sound strictly beyond c is skipped if cut off, suspended if looped, left playing if flagged 0x4, and released otherwise. In range its distance gain is 1 − min(max(d − 0.9c, 0), k) / k with k = c · 0.10000002: recomputed every frame between 0.9c and c, and once on entering 0.9c, which leaving re-arms. A cut-off sound coming back resumes, restarting its stream.

The derivation is in the doc.