function GetTransmissionDuration takes sound soundHandle, integer timeType, real timeVal returns real
local real duration
if (timeType == bj_TIMETYPE_ADD) then
set duration = GetSoundDurationBJ(soundHandle) + timeVal
elseif (timeType == bj_TIMETYPE_SET) then
set duration = timeVal
elseif (timeType == bj_TIMETYPE_SUB) then
set duration = GetSoundDurationBJ(soundHandle) - timeVal
else
// Unrecognized timeType - ignore timeVal.
set duration = GetSoundDurationBJ(soundHandle)
endif
// Make sure we have a non-negative duration.
if (duration < 0) then
set duration = 0
endif
return duration
endfunction