benilla-re systems structs docs

Sound::SetVolume2

function · sound · host

Address
0x7a5dc0 · 120 bytes, up to 0x7a5e37
Meaning
Stores a sound's volume and sets its channel's volume through its category factor and gain
Confidence
verified, proof one
Name from
the community database (idb)
Finding
sound/engine#volume-of-a-sound
Test
sound::channel_volume_mix, sound::volume_ramp_scale

Finding: Volume of a sound in sound: the engine

Sound::SetVolume2(v) stores v at +0x74 and, with a channel, calls FSOUND_SetVolume(ch, ftol(c · v · g · 255.0)) with g the distance gain +0x78 and c the MusicVolume factor for flag 0x2, else AmbienceVolume for 0x8, else none for 0x10, else SoundVolume. The product is in the x87 register and __ftol truncates. Sound::SetVolume(level) passes level · (1/255). Sound::UpdateVolume reapplies +0x74, or level 0 for a sound on the fade list. 0x7a5d70 reads a level back as the low byte of the float v · 255 + 512.5: it rounds, wraps once v · 255 ≥ 255.5 (v ≥ 1.00196), and holds only while v · 255 + 512.5 < 1024.

The derivation is in the doc.

Callers 9

Callees 3

Calls and jumps by a bare address, from tables/calls.tsv.