| 11-09-2008, 12:44 AM | #1 |
I have heard that sounds leak. However I have some sounds that are played as needed on a regular basis and when i destroy them to prevent leaks they never play again... so what do i do to be able to always call on that sound yet have no leaks from it? |
| 11-10-2008, 02:41 PM | #2 |
Are we talking about sounds created in the sound editor here or trigger-generated sound objects? |
| 11-10-2008, 02:55 PM | #3 |
It's lame to destroy sounds, just reuse them. |
| 11-10-2008, 03:41 PM | #4 |
If you're reusing an object, it's not a leak; it still takes up memory, but for a useful purpose, and does not increase over time the amount of memory used. |
| 11-10-2008, 06:29 PM | #5 | ||
Quote:
an imported sound that i give a sound variable to in the sound editor and then call on via a trigger Quote:
I hope it's like you say. I do this a lot. I have about 100 sounds that are reused so much and i was worried that each time a sound was called on it would remember duplicate instances of itself and stack up in the memory. I'm also concerned of float text and timers doing this as well. |
| 11-10-2008, 07:52 PM | #6 |
It depends on how you do it... |
| 11-10-2008, 08:35 PM | #7 |
So the sound won't be played you try to play it when is not finished, but it won't leak because you never create it. The sound editor create one time for you in the map script and set to the global. If you want to be sure the sound will be played every time, you can create the sound each time you need to play it and use the function KillSoundWhenDone, or make a system which recycle sounds. For float text there is an action LifeSpan or something like that (available in gui as well). For timers you should give an example of using them. |
| 11-10-2008, 09:33 PM | #8 | |||
Quote:
Well, what is the way to avoid and which is the safe route? Quote:
Well, making a timer variable and then using the Trigger: Start TimerVar as a One-Shot timer that will expire in 30.00 secondsI use a lot of timers in my maps and I have corrected much of my leaks but there is still lag after playing for extended periods of time and a black screen for often several seconds after game is finished... so I am trying to figure out what causes this when I have destroyed pretty much every player group, position, position offset, special effect, Ini triggers that aren't used anymore, setting unit groups and destroying, dynamic all-pick units, and i am always having every dying unit added to a unit group (which is destroyed) and then removing the units from the game.. I just dont know what else it could be. I thought I had everything covered. I know i use a LOT of timers and a LOT of temporary float-texts and repeating sounds so i figured that is the only thing it could be. Quote:
|
| 11-10-2008, 09:38 PM | #9 | |
Quote:
Knowing and UNDERSTANDING what you are doing. |
| 11-10-2008, 11:29 PM | #10 | |
Quote:
and also don't get sound duration... it's async in some (also) weird way... and caused desyncs in first TcX versions (in case what all sound were custom... and idsabling sound doesnt change the result of return value) aka it seems to depend on your system... |
| 11-10-2008, 11:52 PM | #11 | |
Quote:
What if i have a timer set to the duration of a sound. |
| 11-11-2008, 08:23 AM | #12 | |
Quote:
|
| 11-11-2008, 10:36 AM | #13 | ||
Quote:
Quote:
|
| 11-11-2008, 11:02 AM | #14 |
For the leak that's easy to solve you can null the handle juster after run the function KillSoundWhenDone, i had tested and it doesn't leak. For the order of call is there one safe and which ? |
| 11-11-2008, 11:44 AM | #15 | |
Quote:
|
