# Load bank hanging

**URL:** <https://qa.fmod.com/t/load-bank-hanging/11477>\
**Category:** FMOD Studio\
**Created:** [May 20, 2014, 10:55pm UTC](https://qa.fmod.com/t/load-bank-hanging/11477 "2014-05-20T22:55:29Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![joncol](https://avatars.discourse-cdn.com/v4/letter/j/6f9a4e/32.png) [@joncol](https://qa.fmod.com/u/joncol)\
**Post date:** [May 20, 2014, 10:55pm UTC](https://qa.fmod.com/t/load-bank-hanging/11477/1 "2014-05-20T22:55:29Z")

</div>

Hi,

I have some problems with FMOD\_Studio\_System\_LoadBankFile. I’m trying to use the C API on my Mac (10.8.5), since I didn’t get the linker to work on my PC (using MinGW).

The problem is that when I call FMOD\_Studio\_System\_LoadBankFile it just hangs indefinitely. I’ve tried passing the flag FMOD\_STUDIO\_LOAD\_BANK\_NONBLOCKING to the call and then looped polling the status with FMOD\_Studio\_Bank\_GetLoadingState(). That always returned the value 2: “loading in progress” (FMOD\_STUDIO\_LOADING\_STATE\_LOADING).

I’m a FMOD beginner so I may have missed something basic. I did a Build from within FMOD Studio and put the “Master Bank.bank” where my program could find it. I also copied the “Master Bank.strings.bank” file to this same directory. Do I need to put something else here?

Do the bank files include the audio data itself, or do I have to move the wav files to somewhere?

I’m compiling using clang with C++ 11.

I’ve gotten the lowlevel API to work fine, both on Mac OS (clang, C++ 11) and Windows (with MinGW, C++ 11, using the C API to avoid name mangling problems with the Visual Studio dll). But I’m having much more problems with the Studio API it seems.

I really want to get this working for a game that me and a few friends are working on :).

---

<div class="post-metadata">

**Author:** ![Guest](https://avatars.discourse-cdn.com/v4/letter/g/8dc957/32.png) [@Guest](https://qa.fmod.com/u/Guest)\
**Post date:** [May 22, 2014, 11:14pm UTC](https://qa.fmod.com/t/load-bank-hanging/11477/2 "2014-05-22T23:14:28Z")

</div>

It sounds like you have a static initialisation order issue. Is the sound\_system singleton object defined as a static object, rather than being created inside the sound\_system::get\_instance() function? If so, it will be initialised at static initialisation time. Since the order in which static objects are initialised is undefined, your sound\_system singleton may be getting initialised before static objects inside FMOD, causing all sorts of issues.

---

<div class="post-metadata">

**Author:** ![joncol](https://avatars.discourse-cdn.com/v4/letter/j/6f9a4e/32.png) [@joncol](https://qa.fmod.com/u/joncol)\
**Post date:** [May 23, 2014, 7:49am UTC](https://qa.fmod.com/t/load-bank-hanging/11477/3 "2014-05-23T07:49:19Z")

</div>

It gets initialized inside get\_instance(), so it’s very strange. I’ve also added debugging prints, to be sure.

```auto
sound_system& sound_system::get_instance()
{
	static sound_system instance;
	return instance;
}
```

Well, I guess it’s not easy to find out what’s causing this, and I found a way around it, so I’m pretty good anyway.

---

<div class="post-metadata">

**Author:** ![Guest](https://avatars.discourse-cdn.com/v4/letter/g/8dc957/32.png) [@Guest](https://qa.fmod.com/u/Guest)\
**Post date:** [May 20, 2014, 11:43pm UTC](https://qa.fmod.com/t/load-bank-hanging/11477/4 "2014-05-20T23:43:18Z")

</div>

You probably need to call FMOD\_Studio\_System\_Update to flush the command buffer after calling FMOD\_Studio\_System\_LoadBankFile. By default, the FMOD Studio API runs in asynchronous mode, where all commands are processed by a separate update thread. In this mode, commands you issue are stored in a command buffer, which is only flushed when you call FMOD\_Studio\_System\_Update. It sounds like your issue is occuring because the command buffer never gets flushed, so the load command never reaches the update thread.

Alternatively, you could just call FMOD\_Studio\_System\_LoadBankFile with FMOD\_STUDIO\_LOAD\_BANK\_NORMAL instead of FMOD\_STUDIO\_LOAD\_BANK\_NONBLOCKING.

---

<div class="post-metadata">

**Author:** ![joncol](https://avatars.discourse-cdn.com/v4/letter/j/6f9a4e/32.png) [@joncol](https://qa.fmod.com/u/joncol)\
**Post date:** [May 21, 2014, 6:38am UTC](https://qa.fmod.com/t/load-bank-hanging/11477/5 "2014-05-21T06:38:37Z")

</div>

Hi, thanks for your quick answer! You seem to got a surprising high level of support here :).

The two things you mention I have already tried. The update call doesn’t seem to make any difference, and the load call with the normal synchronous load mode just blocks indefinitely. Any other ideas?

---

<div class="post-metadata">

**Author:** ![Guest](https://avatars.discourse-cdn.com/v4/letter/g/8dc957/32.png) [@Guest](https://qa.fmod.com/u/Guest)\
**Post date:** [May 21, 2014, 7:25am UTC](https://qa.fmod.com/t/load-bank-hanging/11477/6 "2014-05-21T07:25:46Z")

</div>

Hmm, it sounds like something weird is going on. Can you try modifying the simple\_event example (from the FMOD Studio Programmer’s API package) to load your bank?

Also, I missed this question before, sorry:

> [@joncol](#):
>
> Do the bank files include the audio data itself, or do I have to move the wav files to somewhere?

The bank files include the audio data, so all you need for this example is “Master Bank.bank”.

---

<div class="post-metadata">

**Author:** ![joncol](https://avatars.discourse-cdn.com/v4/letter/j/6f9a4e/32.png) [@joncol](https://qa.fmod.com/u/joncol)\
**Post date:** [May 21, 2014, 4:42pm UTC](https://qa.fmod.com/t/load-bank-hanging/11477/7 "2014-05-21T16:42:48Z")

</div>

OK, I can try that. It’s strange though, the exact same code that hanged on Mac works perfectly fine on Windows. Also, I want to stick to the C API and the sample uses the C++ API.

Do you think it can have anything to do with the fact that I’m using Clang instead of gcc?

---

<div class="post-metadata">

**Author:** ![Guest](https://avatars.discourse-cdn.com/v4/letter/g/8dc957/32.png) [@Guest](https://qa.fmod.com/u/Guest)\
**Post date:** [May 21, 2014, 11:35pm UTC](https://qa.fmod.com/t/load-bank-hanging/11477/8 "2014-05-21T23:35:30Z")

</div>

Oh, I didn’t realise it was working on Windows. Can you send your code and your master bank to [support@fmod.org](mailto:support@fmod.org) so we can try to debug it here?

---

<div class="post-metadata">

**Author:** ![joncol](https://avatars.discourse-cdn.com/v4/letter/j/6f9a4e/32.png) [@joncol](https://qa.fmod.com/u/joncol)\
**Post date:** [May 22, 2014, 5:27pm UTC](https://qa.fmod.com/t/load-bank-hanging/11477/9 "2014-05-22T17:27:44Z")

</div>

OK, so I managed to circumvent the error. In my test code, I was doing everything from the constructor of a singleton object (the sound system object). When I move the code to a separate function and call that at a later point it seems to work.

This really confuses me though. I couldn’t reproduce the issue in an isolated program. It only happens in my game, which uses some extra libraries: SFML 2.1, LuaJIT 2.0.3, Boost. And also, as mentioned, it works fine on Windows.

Do you have any theories as to why it hangs when I do work in the constructor? Am I missing something obvious?

Basically the situation is:

```auto
sound_system::sound_system()
{
	initialize(); // init sound system and load some test banks
}

// ...

sound::sound_system* s = &sound::sound_system::get_instance();
```

The above hangs in the call to load a bank.

```auto
sound_system::sound_system()
{
}

// ...

sound::sound_system* s = &sound::sound_system::get_instance();
s->initialize();
```

The above works fine, it seems…
