flutter_soloud icon indicating copy to clipboard operation
flutter_soloud copied to clipboard

docs: What does disposeSound actually do?

Open filiph opened this issue 3 months ago • 2 comments

Description

I'm trying to understand (and hopefully document) the function of disposeSound. It seems that C++ SoLoud has no direct dispose() equivalent. The closest I could find is the destructor (AudioSource::~AudioSource()) in soloud_audiosource.cpp:208, which just calls stop(), which in turn calls Soloud::stopAudioSource(), which calls stopVoice_internal(). I'm not sure if we're calling this from Dart via FFI at all.

My question is: when my game plays 10 songs in a row, do all these songs just stay in (C++) memory forever? I'm assuming their data is not in memory (because LoadMode.disk) but still.

From what I can understand, our disposeSound() only removes the AudioSource from activeSounds (on the Dart side) and from sounds (on the Player / player.cpp) side. No SoLoud API is called. (Or is the destructor called because the ActiveSound is erased from the sounds vector?)

filiph avatar Mar 18 '24 14:03 filiph