function WaitTransmissionDuration takes sound soundHandle, integer timeType, real timeVal returns nothing
if (timeType == bj_TIMETYPE_SET) then
// If we have a static duration wait, just perform the wait.
call TriggerSleepAction(timeVal)
elseif (soundHandle == null) then
// If the sound does not exist, perform a default length wait.
call TriggerSleepAction(bj_NOTHING_SOUND_DURATION)
elseif (timeType == bj_TIMETYPE_SUB) then
// If the transmission is cutting off the sound, wait for the sound
// to be mostly finished.
call WaitForSoundBJ(soundHandle, timeVal)
elseif (timeType == bj_TIMETYPE_ADD) then
// If the transmission is extending beyond the sound's length, wait
// for it to finish, and then wait the additional time.
call WaitForSoundBJ(soundHandle, 0)
call TriggerSleepAction(timeVal)
else
// Unrecognized timeType - ignore.
endif
endfunction