I’m coding a SoundManager class for managing sounds and sound events loaded from the audio system. The sound manager is using an LRU cache with an adjustable memory budget. So, when the sound manager’s memory usage reaches the given memory budget, least recently used sounds/events are unloaded until we’re back within the memory budget. Using the low-level FMOD this was easy because I could use Sound::getLength() to return the amount of bytes for an individual sound, but the FMOD event system seems different. At least for now, the event system’s memory statistic variables are disabled, and in the FMOD docs, it is adviced to use Memory_GetStats() instead. The problem is that there can be many SoundManager objects around, so each SoundManager should have it’s own memory budget. Is there any easy way to keep track of the event system’s memory usage this way?
What I have in mind at the moment is two options:
Use Memory_GetStats() before and after loading a sound event group’s data. The delta value would be the increase in the sound manager’s memory usage.
Keep only track of the memory allocated by the in-memory FSBs. I’m not sure, though, if this is accurate enough.
Thanks in advance.
- JoniM asked 8 years ago
- You must login to post comments