0
0

OK, I am absolutely puzzled by this declaration:
[code:690ipbbz]typedef FMOD_RESULT (F_CALLBACK FMOD_STUDIO_EVENT_CALLBACK)(FMOD_STUDIO_EVENT_CALLBACK_TYPE type, void parameters);[/code:690ipbbz]

How do I declare a callback?
[code:690ipbbz]
// in foo.h
class Foo {
FMOD::Studio::EventInstance eventinstance;
FMOD_RESULT onEvent(FMOD_STUDIO_EVENT_CALLBACK_TYPE type, void* parameters); //????
void bind();
}

// in foo.cpp
void Foo::bind() {
eventInstance.setCallback(Foo::onEvent); //does not work ???
}

void Foo::onEvent(FMOD_STUDIO_EVENT_CALLBACK_TYPE type, void* parameters) {
// how do I access parameters?
}
[/code:690ipbbz]

Thanks for answering this newb question!

  • You must to post comments
0
0

Your callback needs to have F_CALLBACK in the declaration. If it’s a class member function, it also needs to be static:

[code:3ivrm4t8]
static FMOD_RESULT F_CALLBACK onEvent(FMOD_STUDIO_EVENT_CALLBACK_TYPE type, void* parameters);
[/code:3ivrm4t8]

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.