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 index after it has been destroyed will give an error. It should be noted that this will free up the stream but on the target platform this may not show up in a memory manager. This is because GameMaker Studio 2 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(filename);
Argument | Description |
---|---|
filename | The file to stream the audio from. |
NA
audio_destroy_stream(snd);
The above code removes the sound indexed in the variable "snd" from memory.