I’m new here and maybe this question was already answered but i couldn’t find it.
So here is a small piece of code i use to get event to play:
[code:3udsutsd]FMOD::EventGroup *group(nullptr);
FMOD::EventGroup *subGroup(nullptr);
FMOD::Event *bufEvent(nullptr);

TheFMODMgr->EVENTproject->getGroupByIndex(EVENTGROUP_SHIPS, true, &group);
group->getGroupByIndex(EVENTGROUP_SHIPS_WEAPONS, true, &subGroup);
subGroup->getEventByIndex(EVENT_WEAPONS_WEAPONS, FMOD_EVENT_DEFAULT, &bufEvent);
Everything is working.
But one thing just keeps me bothering. If i launch it under debugger step by step "bufEvent" address looks like 0x00000001, which i beileve is wrong. But the most strangest is that it works. "group" and "subGroup" variables show their address correctly (i think).

Using: VS PRO 2008 (with all service packs and updates) + FMOD 4.30 (downloaded from main download page).

  • You must to post comments

Hi Ca$per, welcome to the forums.

[quote:25heco19]If i launch it under debugger step by step "bufEvent" address looks like 0x00000001[/quote:25heco19]
Yes this is due to our API using handles not pointers. The system will process that handle and translate it into a pointer internally. If you have a handle which is invalid, rather than getting an access violation, the function will return FMOD_ERR_INVALIDHANDLE.

For example:
[code:25heco19]FMOD_RESULT result = ((FMOD::Event*)NULL)->start();[/code:25heco19]
will not crash!

For this reason it is critical that you check the FMOD_RESULT returned from [i:25heco19]every[/i:25heco19] FMOD function call you make. It generally easiest to make an ERRCHECK function like what is used in our examples.

  • You must to post comments

Thank you for your explanation.
I haven’t thought about this. It makes sense now.
And yes. I have a bunch of ERRCHECK in all places.

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.