0
0

This is a post I put in the FMOD Designer Forum, but I’m not getting any bites there perhaps because that is a forum more for content people rather than programmers. Reposting here for better luck.

I originally ran into this problem with 4.38, but I’m now on 4.40 and I still running into it; also I completely scrapped my fdp file and recreated it from scratch, and the problem persists.

================================================

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:3i6n4zvc]
enum SoundIndex {
WSD_BONUSGET = 0,
WSD_CHALLENGECOMPLETE,
WSD_FLYOUT,
//...
[/code:3i6n4zvc]

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:3i6n4zvc]
const int kSoundIDs[NUM_SOUND_FILES] =
{
EVENTID_RUNNER2_COMMON_BONUSGET,
EVENTID_RUNNER2_COMMON_CHALLENGECOMPLETE,
EVENTID_RUNNER2_COMMON_FLYOUT,
//...
[/code:3i6n4zvc]

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

[code:3i6n4zvc]
const int EVENTID_RUNNER2_COMMON_BONUSGET = 136;
const int EVENTID_RUNNER2_COMMON_CHALLENGECOMPLETE = 137;
const int EVENTID_RUNNER2_COMMON_FLYOUT = 138;
[/code:3i6n4zvc]

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:3i6n4zvc]

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:3i6n4zvc]

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

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:3i6n4zvc]
const int EVENTID_RUNNER2_COMMON_HYPER_F_07 = 219;
[/code:3i6n4zvc]

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

Hi,

[quote="GaijinGames":qdwmupuz][code:qdwmupuz] FMOD_RESULT res = fmodEventSys->getEventBySystemID(EVENTID_RUNNER2_COMMON_BONUSGET, FMOD_EVENT_NONBLOCKING, &event);
[/code:qdwmupuz][/quote:qdwmupuz]

I believe the line above is the cause of the issue. The event IDs in the header file are [i:qdwmupuz]project[/i:qdwmupuz] IDs, not system IDs, so you you need to use EventProject::getEventByProjectID:

[code:qdwmupuz] ERRCHECK(fmodProjectFile->getEventByProjectID(EVENTID_RUNNER2_COMMON_BONUSGET, FMOD_EVENT_NONBLOCKING, &event));
[/code:qdwmupuz]

  • You must to post comments
0
0

Good catch, thank you very much!

I was going to put in a note that I was baffled that my use of FMOD worked at all if I was using the wrong IDs throughout the pipeline, but then I rechecked our project and realized that I had the projectID / systemID mismatch only in the section of code where I cache debugNames and in the example I lifted from that code to give you the repro above.

So, turns out this promising lead was unrelated to my crash :/ Back to the drawing board.

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.