0
0

Howdy there, I have a strange crash bug that I’ve spent time accumulating evidence to try and figure out what is wrong, and it’s looking like FMOD Designer is spitting out header IDs that are inconsistent with the state of the FEV file that it loads in.

I have an enum that specify our game’s sound IDs for our engine to understand:

[code:1hfqdh7c]
enum SoundIndex {
WSD_BONUSGET = 0,
WSD_CHALLENGECOMPLETE,
WSD_FLYOUT,
//...
[/code:1hfqdh7c]

which is legacy from the way it used to handle sounds. For the FMOD implementation underneath these enums, there is an array of FMOD Event IDs which the enums index into

[code:1hfqdh7c]
const int kSoundIDs[NUM_SOUND_FILES] =
{
EVENTID_RUNNER2_COMMON_BONUSGET,
EVENTID_RUNNER2_COMMON_CHALLENGECOMPLETE,
EVENTID_RUNNER2_COMMON_FLYOUT,
//...
[/code:1hfqdh7c]

If I dig through the automatically generated header, I find the Event ID definitions as such

[code:1hfqdh7c]
const int EVENTID_RUNNER2_COMMON_BONUSGET = 136;
const int EVENTID_RUNNER2_COMMON_CHALLENGECOMPLETE = 137;
const int EVENTID_RUNNER2_COMMON_FLYOUT = 138;
[/code:1hfqdh7c]

Now, when I try to to actually play it per this code sample below which is an abridged version of our loading routine (but still behaves with the same error)

[code:1hfqdh7c]

include "../../../examples/common/wincompat.h"

include "../../api/inc/fmod_event.hpp"

include "../../../api/inc/fmod_errors.h"

include <string>

include "runner2.h"

using std::string;

void ERRCHECK(FMOD_RESULT result)
{
if (result != FMOD_OK)
{
printf("FMOD error! (%d) %s\n", result, FMOD_ErrorString(result));
exit(-1);
}
}

FMOD::System * fmodSys = NULL;
FMOD::EventSystem * fmodEventSys= NULL;
FMOD_RESULT fmodLastError = FMOD_OK;
int fmodNumVoices = 256;
FMOD::EventProject * fmodProjectFile = NULL;
FMOD::EventGroup * fmodCommonGroup = NULL;

char * fmodMemBlock = NULL;
int fmodMemBlockSize= 35010241024;

void FMOD_MemoryInitialize()
{
fmodMemBlock = new char[fmodMemBlockSize];
ERRCHECK(FMOD::Memory_Initialize(fmodMemBlock, fmodMemBlockSize, 0, 0, 0));
}

int main(int argc, char *argv[])
{
FMOD_MemoryInitialize();

ERRCHECK(FMOD::EventSystem_Create(&amp;fmodEventSys));
ERRCHECK(fmodEventSys-&gt;getSystemObject(&amp;fmodSys));

ERRCHECK(fmodEventSys-&gt;init(fmodNumVoices, FMOD_INIT_NORMAL, 0));

string eventPath = &quot;runner2.fev&quot;;

ERRCHECK(fmodEventSys-&gt;load(eventPath.c_str(), 0, &amp;fmodProjectFile));
ERRCHECK(fmodProjectFile-&gt;getGroupByIndex(EVENTGROUP_RUNNER2_COMMON,     true, &amp;fmodCommonGroup));

ERRCHECK(fmodCommonGroup-&gt;loadEventData());

FMOD::Event          *event = 0;
FMOD_RESULT res = fmodEventSys-&gt;getEventBySystemID(EVENTID_RUNNER2_COMMON_BONUSGET, FMOD_EVENT_NONBLOCKING, &amp;event);

if(res == FMOD_OK &amp;&amp; event )
{
    char * name = NULL;
    event-&gt;getInfo(NULL, &amp;name, NULL);

    printf(&quot;For ID [%d] I should have \&quot;BonusGet\&quot; but actually have \&quot;%s\&quot;&quot;, EVENTID_RUNNER2_COMMON_BONUSGET, name);
    ERRCHECK(event-&gt;start());
}
else
    ERRCHECK(res);

while(!_kbhit())
{
    fmodEventSys-&gt;update();
    sleep(1);
}

fmodEventSys-&gt;release();
return 0;

}
[/code:1hfqdh7c]

I get the output here
[quote:1hfqdh7c]
For ID [136] I should have "BonusGet" but actually have "F-07"
[/quote:1hfqdh7c]

And it plays the sound that it says it does, and not the one that I requested for it to play. Digging through the header file, I find that instead of of loading the file that the header says has ID of 136, it’s loading the file that the header should be at 219

[code:1hfqdh7c]
const int EVENTID_RUNNER2_COMMON_HYPER_F_07 = 219;
[/code:1hfqdh7c]

A note that may or may not be relevant to my issue:
I have two working copies of the project I’m working on, one in GIT that I use for my own development that communicates with main SVN repository, and then an SVN one that I use for collaborating with the others in the office that wouldn’t be comfortable with GIT. I ran into some FMOD Event system problems that turned out to be because the SVN project was trying to use the slightly different assets in the GIT working copy; I have since fixed that and spent a lot of time trying to verify that all of the project paths remain consistent. If there is some path information buried inside the FEV file that isn’t getting refreshed, that might have something to do this.

I can supply you with a repro data files via FTP if you need them.

  • You must to post comments
0
0

An update:

After posting this forum message, I went to the game’s data directory, moved the FMOD Designer FDP file & all of its associated output and backups that had the inconsistencies, and created a new FDP file from scratch in hopes that there was some weird bad state in the file that would go away if I remade it. After re-adding all of the files and plugging in the settings again, the same problems are happening again, although the wrong ids have been pushed into a different direction.

  • You must to post comments
0
0

Further Update: after talking with the other programmer here, he mentioned that he updated the version of the FMOD libs but my version of FMOD Designer (4.38) wasn’t updated to match. I have since updated designer to 4.40, but I still get the same problems even when I clean build.

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.