Studio::EventInstance::setCallback

FMOD Studio API

Firelight Technologies FMOD Studio API

Studio::EventInstance::setCallback

Sets a user callback for the event instance.

C++ Syntax

FMOD_RESULT Studio::EventInstance::setCallback(
  FMOD_STUDIO_EVENT_CALLBACK callback,
  FMOD_STUDIO_EVENT_CALLBACK_TYPE callbackmask
);

C Syntax

FMOD_RESULT FMOD_Studio_EventInstance_SetCallback(
  FMOD_STUDIO_EVENTINSTANCE *eventinstance,
  FMOD_STUDIO_EVENT_CALLBACK callback,
  FMOD_STUDIO_EVENT_CALLBACK_TYPE callbackmask
);

C# Syntax

RESULT Studio.EventInstance.setCallback(
  EVENT_CALLBACK callback,
  EVENT_CALLBACK_TYPE callbackmask = EVENT_CALLBACK_TYPE.ALL
);

JavaScript Syntax

EventInstance.setCallback(
  callback,                        
  callbackmask                     
);

Parameters

callback
Pointer to a callback function.
callbackmask
A bitfield specifying which callback types are required. Masking out some callback types can help avoid a flood of irrelevant callbacks being triggered. Defaults to FMOD_STUDIO_EVENT_CALLBACK_ALL.

Return Values

If the function succeeds then the return value is FMOD_OK.
If the function fails then the return value will be one of the values defined in the FMOD_RESULT enumeration.

Remarks

When Studio has been initialized in asynchronous mode, callbacks will be fired from the Studio asynchronous thread.

If FMOD_STUDIO_INIT_DEFERRED_CALLBACKS is used, then FMOD_STUDIO_EVENT_CALLBACK_TIMELINE_MARKER and FMOD_STUDIO_EVENT_CALLBACK_TIMELINE_BEAT will be deferred until the next update in the main thread, but the other types will still be called asynchronously.

When Studio has been initialized with FMOD_STUDIO_INIT_SYNCHRONOUS_UPDATE, all callbacks will be fired from within the update in the main thread.

Example:

FMOD_RESULT F_CALLBACK MyEventCallback(FMOD_STUDIO_EVENT_CALLBACK_TYPE type, FMOD_STUDIO_EVENTINSTANCE *event, void *parameters);

FMOD_RESULT SetupEventCallback(Studio::EventInstance *eventInst)
{
    return eventInst->setCallback(MyEventCallback, FMOD_STUDIO_EVENT_CALLBACK_STARTED | FMOD_STUDIO_EVENT_CALLBACK_STOPPED);
}

See Also




Version 1.10.03 Built on Feb 1, 2018