1
0

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 :).

  • You must to post comments
0
0

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?

  • You must to post comments
0
0

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:
[quote="joncol":1qxlhd2z]Do the bank files include the audio data itself, or do I have to move the wav files to somewhere?[/quote:1qxlhd2z]
The bank files include the audio data, so all you need for this example is "Master Bank.bank".

  • You must to post comments
0
0

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?

  • You must to post comments
0
0

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

  • You must to post comments
0
0

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:

[code:dy47amqs]
sound_system::sound_system()
{
initialize(); // init sound system and load some test banks
}

// ...

sound::sound_system* s = &sound::sound_system::get_instance();
[/code:dy47amqs]

The above hangs in the call to load a bank.

[code:dy47amqs]
sound_system::sound_system()
{
}

// ...

sound::sound_system* s = &sound::sound_system::get_instance();
s->initialize();
[/code:dy47amqs]

The above works fine, it seems…

  • You must to post comments
0
0

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.

  • You must to post comments
0
0

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

[code:2psk44o7]
sound_system& sound_system::get_instance()
{
static sound_system instance;
return instance;
}
[/code:2psk44o7]

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.

  • You must to post comments
0
0

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.

  • You must to post comments
Showing 8 results
Your Answer

Please first to submit.