MUST READ:
Audio Unloading features have been added for Construct 2 releases starting from r242,
it's highly recommended to use the official plugin instead of this one!
Description:
The AudioPlus object plays back audio just like the official plugin does but it also
comes with a set of highly requested enhancements, more details can be found below.
Plugin Download & Example:
The AudioPlus Plugin: Download | The AudioPlus Example: Download
Features:
<Action> Unload all sounds
Clears the buffer of all preloaded sounds.
<Action> Unload sound
Clears the buffer of a single audio file.
<Action> Unload by name
Clears the buffer of an audio file by name.
<Action> Unload by tag
Clears the buffer of audio files by tag.
How It Works & Limitations:
Releasing/Unloading audio files from memory isn't as easy as you would expect it to be.¹
Javascript is using something called "Garbage Collector" to release not needed (not used anymore) data from memory.
In order to release audio from memory, we're required to basically mark the audio files that
we would like to release as "garbage" and wait for the Garbage Collector to do the work.
What this means for C2 developers is that releasing audio from memory will never happen
instantly and will always come with a delay, the delay varies and can take up to 10 seconds.
Advice & Best Practices:
"Unload All Sounds" will unload all sounds from memory by using a single action.
You can also simply select specific soundfiles that you would like to unload from a dropdown list.
It's also possible to unload specific sounds by using a tag or the actual filename.
The AudioPlus plugin will automatically stop the playback of the audiofiles before unloading them.
Please keep in mind, even with the implemented stopping mechanism which stops the active playback
of audio files, it's recommended not to unload audio files which will still be used in the next layout.
Basically only unload audio files which are not required anytime soon!
Credits & References:
¹Detailed information about JS memory management (
Mozilla-Memory Management)
Plugin by
— (Toby R. Wtfgamesgroup)
Stuff by TheRealDannyyy (
)