SLUDGE

freeSound


Syntax:

freeSound (soundFile);

Purpose:

Removes the soundFile file from the SLUDGE sound cache. Why? Because the more sounds you have in the cache - especially big ones - the more memory is taken up, and the slower your game may run on some older computers. So, if you've just finished using a huge great sound that you don't need again for a while, use this function to reclaim some memory.

Please note that the cache can only hold 8 sounds at once, so older sounds will be unloaded once they're not needed automatically anyway - you don't need to use freeSound to make your game work, and freeing up memory used by tiny little sounds (up to a few seconds long) won't make much of a difference.

Return value:

No return value.

Example:

# Start a sound playing
playSound ('bigLongSound.wav');

# Wait 10 frames and then stop it
pause (10);
stopSound ('bigLongSound.wav');

# We don't need the sound in the cache any more...
freeSound ('bigLongSound.wav');

See also:

Using Audio in SLUDGE

loopSound

playSound

stopSound