Duke3D: Sounds defined in DEF are inaudible with a volume of 1.0
In commit r8291 (501f8e67) volume control was altered such that it now uses fix16_t
instead of float
.
This commit forgot to change the sound
DEF command, which uses a double
type variable to store the sound volume. This is then passed to S_DefineSound
which implicitly converts it to float
, and it then attempts to convert the value from float
to fix16_t
.
The assumption made in the DEF sound
command is that the default volume is 1.0
. However, since the internal default volume with fix16_t
is 0x00010000
, the implicit conversion results in a fix16_t
value of 0x00000001
, which is completely inaudible. In fact, setting the volume to 65536
inside the DEF script results in the normal volume level, confirming my theory.
Edited by Dino Bollinger