Getting ERR_INVALID_HANDLE when trying to play sound

Hi,

In my game, I have a Studio Bank Loader that loads bank for that scene at the beginning of scene and unloads at end of scene. In the next scene, I also have a Studio Bank Loader which loads the bank for that scene. However, if the same event is in two banks (for scene 1 and scene 2), the scene 2 won’t start(). Calling start() the first time returns OK but no audio is heard and PLAYBACK_STATE is STOPPED. When I try to call start() again, I get ERR_INVALID_HANDLE.

I am sure that the banks are set up correctly. Possibly of importance is that I also have another Studio Bank Loader in a singleton object that loads Music bank (so that music can continue playing nonstop across scenes).

One other clue: any event that wasn’t loaded in previous scene works fine… Just not same events. Which doesn’t really make sense to me since previous bank should be unloaded and new one loaded.

At this point I really tried everything I could think of and I can’t think of any other clues to fix this.

UPDATE: I fixed it! But solution is more puzzling to me than original problem. The solution was to take out ALL Studio Bank Loaders. However, sound still plays and now no errors with RESULT! How?? How are events being loaded without the bank loaded?? Did something change in latest fmod version? In the past it used to crash when I tried to do that. Now, loading banks makes it not work.

Thank you,
Omer

If you’ve updated from the Legacy to the V2 integration then the loading strategy has changed. On the settings there is a option (on by default) to load all Banks at startup.

Check your loadBank function calls and look for EVENT_ALREADY_LOADED return code.

If you have an EventDescription or EventInstance objects and you unload/load the banks then the isValid() function will return false and any other function calls will return INVALID_HANDLE.

1 Like

Thanks for the clarification! Is there any downside to loading all banks at startup? It doesn’t actually use RAM until I load the sounds ie. with CreateInstance(path), right?

It uses some memory to load the event metadata, but the bulk of the memory consumed by a bank is the sample data (which can be set to load up front as well in the settings).

1 Like