0
0

[code:14x5acts]
FMOD_RESULT F_CALLBACK eventCallback(FMOD_EVENT* event, FMOD_EVENT_CALLBACKTYPE type, void * param1, void * param2, void * userdata)
{
switch (type)
{
case FMOD_EVENT_CALLBACKTYPE_EVENTFINISHED:
{
FMOD::Event* pEvent = (FMOD::Event*)event;
FMOD_EVENT_INFO info;
memset( &info , 0 , sizeof(FMOD_EVENT_INFO) );
pEvent->getInfo( 0 , 0 , &info );
if (info.instancesactive == 0)
{
// put to free data event list –> freeEventList
}
}
break;
}

return FMOD_OK;

}
[/code:14x5acts]

in another thread

[code:14x5acts]
void tick()
{
// iterate freeEventList, for every event –> pEvent
FMOD_EVENT_INFO info;
memset( &info , 0 , sizeof(FMOD_EVENT_INFO) );
pEvent->getInfo( 0 , 0 , &info );
if (info.instancesactive == 0)
{
EventGroup * group = NULL;
result = pEvent->getParentGroup( &group );
if( result == FMOD_OK )
{
result = group->freeEventData( pEvent );
}
}
}
[/code:14x5acts]

this is not workable,no event is putted in the free list.
the more event is played & stoped, the more memory is used.
then I modified the eventCallback as follows:

[code:14x5acts]
FMOD_RESULT F_CALLBACK eventCallback(FMOD_EVENT* event, FMOD_EVENT_CALLBACKTYPE type, void * param1, void * param2, void * userdata)
{
switch (type)
{
case FMOD_EVENT_CALLBACKTYPE_EVENTFINISHED:
{
FMOD::Event* pEvent = (FMOD::Event*)event;
FMOD_EVENT_INFO info;
memset( &info , 0 , sizeof(FMOD_EVENT_INFO) );
pEvent->getInfo( 0 , 0 , &info );
if (info.instancesactive == 1)
{
// put to free data event list –> freeEventList
}
}
break;
}

return FMOD_OK;

}
[/code:14x5acts]

everything is ok. why instancesactive is 1 when event is finished?

fmod version is:
[code:14x5acts]

define FMOD_VERSION 0x00044106

[/code:14x5acts]

thanks in advance, sorry for my poor english.
xiaocaihua

  • You must to post comments
Showing 0 results
Your Answer

Please first to submit.