We have a system in our game that allows the player to create a vast amount of objects at any time. Each object has it’s own SFX that plays when it is created.
The problem is, our bank for all of these sounds (around 250) is ~10MB. We need these sounds loaded into memory, but we don’t need all of them at the same time, just the ones based on the player selection.
Is there a way to have FMOD load into memory just the events that we know are needed? Ie- if a bank has 20000 sounds, can we load into memory 10 of them and avoid storing all the sounds in memory at the same time?
- Matt_hns asked 5 years ago
Loading a bank file will only load the metadata, which should be pretty small. The sample data is not loaded until you instantiate an event via EventDescription::createInstance. Samples are loaded asynchronously; you can check the loading progress by calling EventInstance::getLoadingState. Samples will be unloaded when you release the last event instance that uses them.
Hmm I suppose our system is doing things differently.
We’re using a 3rd party engine, and they seem to be loading the whole FSB into memory using preloadFSB.
Is there an example we can look at to play events marked ‘Load Into Memory,’ but only consume memory on demand?
Oh, it sounds like you’re using FMOD Designer rather than FMOD Studio, is that right? The preloadFSB function doesn’t exist in the FMOD Studio API.
The preloadFSB function will load all of the sample data in the specified FSB into memory. If your engine allows you to control when FSBs get preloaded, I suggest you distribute your waveforms among multiple banks (e.g. one bank per game object) using the Banks tab in FMOD Designer. You can then just load the FSBs that you need, based on the objects that exist in the game.
Please login first to submit.