Need help setting up ChannelGroup callbacks for sync points

Hi there!
I’m currently working on setting up a closed captioning system for a project. My current intention is to control the timing of subtitles by embedding sync points into our audio assets and using callbacks to communicate with the captioning system.

Unfortunately, despite using setCallback on the channel group retrieved from the event instance and receiving a result “OK” in return, nothing happens for any type of callback - the method I passed through setCallback to handle ChannelControl callbacks is never actually called at all.

I have attempted a variety of things to figure out what I was doing wrong. I know for sure the sync points on the sound in the event are present, given I can read them out with getNumSyncPoints. There are no errors, warnings, or undesirable result returns on anything.

Here’s a simplified snippet of the code used for testing (the instance is created and started elsewhere):


private FMOD.RESULT CreateCaptioningCallbacks(FMOD.Studio.EventInstance instance) {
  // Presuming we wait for the event to load and this is always OK (which it has been during testing)
  FMOD.ChannelGroup masterTrack;
  instance.getChannelGroup(out masterTrack);

  callback = new FMOD.CHANNELCONTROL_CALLBACK(ChannelControlCallback);
  return masterTrack.setCallback(callback); // During testing this always returned OK

private FMOD.RESULT ChannelControlCallback(IntPtr cc, FMOD.CHANNELCONTROL_TYPE ct, FMOD.CHANNELCONTROL_CALLBACK_TYPE cbt, IntPtr cd1, IntPtr cd2) {
  Debug.LogError("any callback"); // But this never happened under any circumstances
  return FMOD.RESULT.OK;

There was no difference when the ChannelControlCallback method was made static and the AOT.MonoPInvokeCallback attribute present in the Scripting Examples for Event Callbacks was added.

I’ve been staring at the API documentation for a while now and looking all around online but I can’t figure out what I am getting wrong - some help would be much appreciated!

Version of FMOD is 2.01.03, Unity 2019.4.11f1.


The issue is SyncPoint callbacks are issued from FMOD::Channel not FMOD::ChannelGroup. To get to the FMOD::Channel you’d need to walk the FMOD::ChannelGroup hierarchy, getNumGroups, getGroup, getNumChannels, getChannel, etc. You would also need to do this after the Channel has been created.

Thanks mathew!
Had to fiddle around a bit but got it work successfully. Feels like a weight has been lifted; cheers!