Remove resource from audiostreamplayer

TheMnkTheMnk Posts: 47Member
edited August 31 in Audio

Hi, there seems to be no way to remove audio (loaded from an audiostreamplayer) from memory.

Suppose you have an audiostreamplayer node, then you load multiple files into it (it's stupid to do it this way but it's a test and can be done like this correctly):

streamPlayer.Stream = (AudioStream) ResourceLoader.Load ("...");
streamPlayer.Stream = (AudioStream) ResourceLoader.Load ("...");
streamPlayer.Stream = (AudioStream) ResourceLoader.Load ("...");

In my tests that takes up more and more ram because there is no way to download the audio loaded into an audiostreamplayer:

streamPlayer.Stream = (AudioStream) ResourceLoader.Load ("...");
streamPlayer.Stream.UnloadResource ();
streamPlayer.Stream = (AudioStream) ResourceLoader.Load ("...");
streamPlayer.Stream.UnloadResource ();
streamPlayer.Stream = (AudioStream) ResourceLoader.Load ("...");
streamPlayer.Stream.UnloadResource ();

Ok, that would erase the audio loaded into the node and there would be no more ram consumption than necessary.

I just want to use a single audiostreamplayer node so that I can play multiple audio files at different times but since there is no way to download the resource from the audiostreamplayer node, these problems exist.

Comments

  • TwistedTwiglegTwistedTwigleg Posts: 3,103Admin

    I would suggest making an issue on Godot repository or a proposal on the proposal repository, since this seems like a missing feature that should be implemented, assuming neither already exists.

  • TheMnkTheMnk Posts: 47Member

    Hello, I did longer tests and actually the RAM consumption increased but after a short time it decreased again, we do not know what happens to a loaded file when another file is loaded again.

  • TheMnkTheMnk Posts: 47Member

    Ok solved

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file