Marhsalling to Channel after getting callback

Im trying to handle a callback in unity from an arbitrary sound ending using the programmer sounds API… it looks something like this:

FMODUnity.RuntimeManager.CoreSystem.createSound(Application.streamingAssetsPath + “/” + eventId, soundMode, out FMOD.Sound fmodSound);

    FMODUnity.RuntimeManager.CoreSystem.playSound(fmodSound, musicChannelGroup, false, out soundChannel);


With channel result looking something like this:

private RESULT channelResult(IntPtr channelcontrol, CHANNELCONTROL_TYPE controltype, CHANNELCONTROL_CALLBACK_TYPE callbacktype, IntPtr commanddata1, IntPtr commanddata2)
Channel passedChannel = Marshal.PtrToStructure(channelcontrol);
return RESULT.OK;

However, it crashes unity and when I check the logs it looks like it’s throwing an NRE.

My question is, are there any examples of the correct way to recieve/handle the callback from a channel finishing a sound in C#?

After a lot of digging I ended up finding my answers via the Programmer Sounds example, documentation and other forum posts. Long story short I was doing things the wrong way…