0
0

I wrote a C++ wrapper that uses the FMOD Designer API, It seems to work fine normally, until I use the SetCallBack function in the FMOD Event class.

The sound event loads correctly because I check the progress using the get state function, but if I set a call back, it will crash because there is an internal that is NULL.

  • You must to post comments
0
0

We aren’t aware of any problems with the event callbacks and there are a number of wrappers out there which implement callbacks with no problems.

Some things to check:
Does your callback have the right function signature or are you casting it? Are you returning an appropriate FMOD_RESULT value from your callback?

There is some example code for using the event callbacks in the programmersound example.

Hope this helps,

-Pete

  • You must to post comments
0
0

It’s not the callback directly that is giving me the issue, the callback gets the events like the create and info.

CPreloadSound* preload = new CPreloadSound( szEventPath );
m_FMResult = m_pEventSystem->getEvent( szEventPath, fmLoadingMode, &preload->m_pEvent );
m_FMResult = preload->m_pEvent->setCallback( (FMOD_EVENT_CALLBACK)FMEventCallback, preload );
if( m_FMResult != FMOD_OK )
{
delete preload;
preload = NULL;
return preload;
}
preload->m_bInMemory = ( fmLoadingMode & FMOD_EVENT_NONBLOCKING ) ? ( false ) : ( true );
return preload;

The line that gives me the problem is the SetCallback where I pass the instance of my class.
If I comment out that line it works properly, but if I have it the callback does function,
but the something about the sound is null, though my pointer to the FMOD::Event is 0x00000001 and
with all FMOD_OKs being given. That includes FMOD_OK being given back from the setcallback function.

  • You must to post comments
0
0

[quote:2sa5b3pv]m_FMResult = preload->m_pEvent->setCallback( (FMOD_EVENT_CALLBACK)FMEventCallback, preload ); [/quote:2sa5b3pv]
You shouldn’t be casting your callback. You function signature probably doesn’t match what is expected.

It should read like this:
[quote:2sa5b3pv]m_FMResult = preload->m_pEvent->setCallback( FMEventCallback, preload ); [/quote:2sa5b3pv]
If that is giving you compile errors then you need to modify the signature of your callback.

  • You must to post comments
0
0

Oh my goodness! Thanks so much, I cant belive I made such a rediciolous mistake. It was exactly that, I had it as the wrong return type, but I dont understand why that would cause such a problem. 😆

Thanks alot Peter, you were tons of help.

  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.