If you have previously created an audio stream from a file using the function audio_create_stream and no longer need that sound, you can call this function to delete it from memory. Any further calls to the sound after it has been destroyed will give an error.
NOTE This will free up the stream but on the target platform this may not show up in a memory manager. This is because GameMaker pools memory resources to prevent memory allocation overhead, and so the memory will remain allocated until required for something else or re-used for a new stream.
NOTE This functionality is not available for the HTML5 target platform.
audio_destroy_stream(sound);
Argument | Type | Description |
---|---|---|
sound | Sound Asset | The sound asset, as returned by audio_create_stream |
Real (1 if the stream was successfully destroyed, -1 if it wasn't)
audio_destroy_stream(snd);
The above code removes the sound stored in the variable snd from memory.