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?
// 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?

Thanks for answering this newb question!

  • You must to post comments

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

static FMOD_RESULT F_CALLBACK onEvent(FMOD_STUDIO_EVENT_CALLBACK_TYPE type, void* parameters);

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.