[CLOSED] Experimental AudioPlus Plugin (+Unloading Audio)

0 favourites
  • 11 posts
From the Asset Store
Antisuspend Plugin for Construct 3 prevents the runtime from getting suspended.
  • 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 (

    Subscribe to Construct videos now

    )

  • * moved to a more relevant section. If you consider this plugin complete then let me know and I'll move it to the Completed section.

  • * moved to a more relevant section. If you consider this plugin complete then let me know and I'll move it to the Completed section.

    Surething do as you like @zenox98, it's finished/complete. (Sorry for posting it in the wrong section.)

    We've just called it experimental for testing purposes but private tests were all positive with next to no bugs found.

    Ashley Sorry if I'm tagging you too much but here it is, feel free to share feedback.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks for the great and detailed wrap-up of the plugin TheRealDannyyy!

    BTW: here's a short test of sound unloading I made with TheRealDannyyy 's tool (so you could see how much memory it can save):

    Subscribe to Construct videos now

    Ashley I saw you said:

    I'll try and get audio unloading in the next build...

    That's awesome. I know you can handle this yourself, still if you find the snippets from AudioPlus plugin useful you're obviously free to put them in the official plugin. I've used a lot of official code anyway.

    One additional thing. Because of unloading features, the common approach will be now to not preload all sounds and startup but load them selectively. Therefore I was planning to add On sound preloaded condition. But as you're planning to add it to the official one, I'll pass with this one. Still it would be great if you could implement such condition to the plugin so C2 devs could make nice visual preloaders.

    Thanks

    EDIT - Updated YT URL above, now it has much better quality.

  • awesome plugin! but im not sure if wold be good as clearing the "garbage" or buffer cache wold basically make people redownload the buffer each time the same song/sound plays therefor increasing lagging/buffering time... the normal audio seems more suited for games.. while this plugins seem something you wold use in a particular project.. where clearing buffer wold increase performance and then never to use the particular sound again.

    great job! but not for me!

  • awesome plugin! but im not sure if wold be good as clearing the "garbage" or buffer cache wold basically make people redownload the buffer each time the same song/sound plays therefor increasing lagging/buffering time... the normal audio seems more suited for games.. while this plugins seem something you wold use in a particular project.. where clearing buffer wold increase performance and then never to use the particular sound again.

    great job! but not for me!

    Of course it is pointless to release the buffer of the audio which you will use later in game. This feature is for bigger projects which have many unique audios per level.

  • This type of plugin is really bad for compatibility for all the reasons described here.

    I know people need these features, and sometimes people need them sooner than we provide them. However if it is remotely possible, the plugin should be minimal code to patch code in to another plugin. It's not always possible, but when you take this "copy and paste" approach and copy the entire plugin wholesale, you can easily create worse problems than the plugin aims to solve.

  • This type of plugin is really bad for compatibility for all the reasons described here.

    I know people need these features, and sometimes people need them sooner than we provide them. However if it is remotely possible, the plugin should be minimal code to patch code in to another plugin. It's not always possible, but when you take this "copy and paste" approach and copy the entire plugin wholesale, you can easily create worse problems than the plugin aims to solve.

    I totally agree. That's why we ask you to add those extra features to the official Audio plugin. AudioPlus is not released as a completed addon. It's experimental just to test the possibilities of releasing the memory. I am not keen (and I'm not about) to maintain this or keep it as my official plugin for obvious reasons (like those listed in your article).

    But as far as I am aware those features were requested over a year ago. Still official Audio doesn't have releasing memory implemented and that's why I gave it a try to see if it's really that problematic to implement. It looks like it works, added just few functions. For some projects this feature is an absolute must-have, so even tho this is an experimental addon, I would personally rather to launch my game with such plugin than not be able to launch my game at all.

    Anyway, it's here and it works and we ask you to implement those into the official plugin. I know you're a busy man so I hope my code will save you some time if you decide to use it, and we (C2 devs) will have it in Audio plugin.

  • "sometimes people need them sooner than we provide them"

    The problem is that no one knows when sooner or later is.

    We dont even know if Scirra is working on it, will ever work on it or has even heared of problem x y.

    It would be really great to know what is worked on and whats in the queue not only for c2 but also for the website the learning resources etc.

    It doesn't have to be maintained only by Scirra either, we are a great helpfull community here and there are plenty of people around that would help maintaining a Trello page for example.

    Godot has a trello roadmap https://trello.com/b/Vl7OgSuq/godot-engine-2-1

    Unreal Engine 4 has a trello roadmap https://trello.com/b/gHooNW9I/ue4-roadmap

    Unity has a roadmap https://unity3d.com/de/unity/roadmap

    There is probably something like this in place internally to keep track of what has to be done but it would make a big difference if it was open for the c2 community

  • Ashley

    I agree with you.

    However, programmer only could "copy and paste" official plugin into a 3rd party plugin, because that it is the only one way to solve this issue.

    • Can programmer add behavior (plugin) for audio plugin? No, only sprite-like plugin could have behavior plugin, but even behavior plugin could not solve this issue either.
    • Can programmer control the behavior of audio plugin? No, even programmer could reuse the ACE of audio plugin. ( I know you don't like it, either)
  • So now we know that it just requires a community made plugin in order to get Ashley to add highly requested features.

    Just kidding, thanks a lot Ashley!

    (Closing this one for now, please update to r242+ in order to get the "more official" unloading features!)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)