- Joined
- Mar 26, 2009
- Messages
- 301
I have got a question; do undestroyed sounds cause leak? There is a Destroy Sound trigger line, should we use it after each sound play (including sounds from "Unit Transmission" triggers)
Just don't destroy them, they aren't making any leaks in GUI. AFAIK.
scope sounds initializer onInit
globals
private sound gg_snd_Doom = CreateSound( "Sound\\Music\\mp3Music\\Doom.mp3", false, false, false, 10, 10, "" )
endglobals
private function again takes nothing returns nothing
if gg_snd_Doom != null then
call BJDebugMsg("Sound still exists")
else
call BJDebugMsg("Sound was destroyed")
endif
endfunction
private function onInit takes nothing returns nothing
call SetSoundChannel( gg_snd_Doom, 0 )
call SetSoundVolume( gg_snd_Doom, 127 )
call SetSoundPitch( gg_snd_Doom, 1.0 )
if gg_snd_Doom != null then
call PlaySoundBJ( gg_snd_Doom )
call KillSoundWhenDoneBJ( gg_snd_Doom )
else
call BJDebugMsg("The sound was never initiliazed")
endif
call TimerStart(CreateTimer(), 5, false, function again)
endfunction
endscope