Is it possible to load a Bank from an EventInstance or EventReference?

Exactly what the title says.

It isn’t possible.

If your bank isn’t loaded, then it’s not possible to create an instance of an Event assigned to that bank in the first place, and unloading a given bank will cause the FMOD system to destroy all instances of constituent events. EventReferences contain an event’s GUID/path, which can be used to get the corresponding EventDescription and check in a roundabout way which bank contains the event, but this is only possible if the bank it is assigned to is already loaded.

Can I get you to provide a little more context as to why you’re asking the question?

Basically, for every Event in the game, when the EventInstance is created, I want it to check if the Bank that the Event belongs to is loaded, and if it’s not then load it.

The main problem being that I’ll have no way of knowing which banks to load ahead of time due to having many different types of enemies with different sound sets. Each sound set will be one bank.

I’d also like to avoid having to load the bank separately from the sound effects cause when designing the enemies you have the option to use sounds from other banks.

I’ve never used FMOD before so pardon my ignorance.

No problem!

If you weren’t aware, by default audio data isn’t actually loaded into memory when you load a bank - instead, the data is loaded on-demand when an event instance is created. You can choose to manually load audio data for an event or an entire bank ahead of time if you need to as well, which is useful for events with a large amount of audio data, and/or when you need to play events with sample-accurate timing. I would recommend reading our documentation on Sample Data Loading for more information.

The expected workflow with FMOD is to have a broad knowledge of what sounds you need played at any given time in-game, as this typically informs both how you sort/group individual events into banks in FMOD Studio, and which banks you load at a given time in-game. For example, you may know that for a given level you’ll only need a specific set of events; therefore, you create a bank for those events, and only load it for that level.

If you have no idea which banks you’ll need loaded ahead of time, it may be worth planning them out to see what events will be needed where. Alternatively, you may choose to load many or all banks at once, and only load the sample data as needed. Ultimately, it depends on your project, of which you’re the best judge.

If you have any more questions, feel free to ask!

I see, so if I load a bank but don’t load the sample data, it doesn’t load the audio into memory? If so that’s exactly what I’m looking for! Thanks.

1 Like

Exactly - by default, loading a bank only loads its metadata (i.e. events and their structure), unless you call Studio::Bank::loadSampleData, which will load all non-streaming sample data for the bank into memory.

1 Like

Thank you, so much. I’ve been searching everywhere for this information!