benilla-re systems structs docs

Sound::GetVolumeLevel

function · sound · primitive

Address
0x7a5d70 · 47 bytes, up to 0x7a5d9e
Meaning
Returns a sound's volume as a level, the low byte of v · 255 + 512.5
Confidence
verified, proof one
Finding
sound/engine#volume-of-a-sound
Test
sound::channel_volume_curve, sound::channel_volume_rate_stream

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 1

Callees 0

None by a direct call or jump.

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