HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

KillSoundWhenDone?

09-09-2006, 05:21 PM#1
UnMi
Uh...how does this one work?
Are you supposed to KillSoundWhenDone a global sound variable like gg_snd_OK once used (StartSound(gg_snd_OK))?
09-09-2006, 06:14 PM#2
The)TideHunter(
Use start sound then KillSoundWhenDone, wether it be a global or a local.
09-09-2006, 06:21 PM#3
UnMi
That would both kill and stop the sound immediately.
Would it "leak" if I don't kill the sound?
09-09-2006, 06:44 PM#4
The)TideHunter(
KillSoundWhenDone does what it says, it kills the sound when its finished playing, you dont have to destroy the sound, that is what destroys it.
So it dosent leak.
09-09-2006, 06:51 PM#5
UnMi
I mean would it leak if I
StartSound(gg_snd_OK) and don't do KillSoundWhenDone(gg_snd_OK)?
And that KillSoundWhenDone does not kill the sound when it's done, it kills it immediately, thus stopping it too.
09-09-2006, 08:05 PM#6
Captain Griffen
Doing it to globals or locals will destroy the sound at the end. With globals, this will be a problem, as you don't dynamically create them.

It can also have issues. Unless the sound variable was created in the sound editor, the sound file must be preloaded to avoid issues for the first few usages.
09-10-2006, 07:44 AM#7
vile
KillSoundwhendone is bugged, sometimes it will immediately stop the sound. Use it only after the sound's actual duration. I made a thread on this.
09-10-2006, 08:21 AM#8
Captain Griffen
If you preload it, that won't happen. At least that is my experience, and backed up by those created in the sound editor not doing it.
09-10-2006, 10:22 AM#9
vile
Why would you want to preload each sound you ever want to make? Just use a simple function that does it after the specified duration.
09-10-2006, 10:35 AM#10
UnMi
Hmm, so it does leak if I don't KillSoundWhenDone?
09-10-2006, 10:51 AM#11
Captain Griffen
If you don't destroy the sound and it is dynamically created, then it will leak, yes.

Quote:
Why would you want to preload each sound you ever want to make? Just use a simple function that does it after the specified duration.

Copy-paste-insert string is a lot easier for me, and also a lot more efficient, than destroying them after a certain time.
09-10-2006, 10:52 AM#12
blu_da_noob
Quote:
Originally Posted by vile
Why would you want to preload each sound you ever want to make? Just use a simple function that does it after the specified duration.

Because preloading whould be much, much simpler. A function to do that manually would require that you know the exact duration and would require creating a timer, attaching the sound etc.
09-10-2006, 11:14 AM#13
UnMi
Hmm, and how do you preload? >_<
09-10-2006, 11:20 AM#14
blu_da_noob
Collapse JASS:
call Preload("Music\\ImportedSounds\\Lolyeah")
09-10-2006, 11:43 AM#15
UnMi
K thx. wtf i knew it!