0
0

I set a callback function to stop a event when sound end, and for ‘oneshot’ event it’s ok. But for ‘loop’ event and the ‘max playbacks = 1’, when the event been stolen, it crash.
FMOD_RESULT F_CALLBACK EventCallBack(FMOD_EVENT * event,
FMOD_EVENT_CALLBACKTYPE type,
void * param1,
void * param2,
void * userdata)
{
FMOD::Event* pEvent = reinterpret_cast<FMOD::Event*>(event);

switch(type)
{
case FMOD_EVENT_CALLBACKTYPE_SOUNDDEF_END:
pEvent->stop(true);
break;
}

return FMOD_OK;
}

how to fix it? thanks.

  • You must to post comments
0
0

Hi groov0v,

Your problem sounds quite unusual. Our callbacks are thoroughly tested, most problems with callbacks are caused by improperly formed callback functions but yours looks ok.

[quote:2i13fea5]when the event been stolen, it crash. [/quote:2i13fea5]
Does it crash inside FMOD or inside your callback?

If the crash is inside your callback, it could be due to the use of reinterpret_cast. Does it still crash if you change that to a static_cast or a C-style cast?

If the crash is inside FMOD can you post the code where you call setCallback?

-Pete

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.