Native Audio Plugin resetCallback to reset the plug in to its initial sate?

I’m building a Native Audio Plugin in C++ and currently having issues when Unity moves from being in play mode to out of play mode. From what I understand from the documentation the call back:

UNITY_AUDIODSP_RESULT UNITY_AUDIODSP_CALLBACK ProcessCallback(UnityAudioEffectState* state, float* inbuffer, float* outbuffer, unsigned int length, int inchannels, int outchannels)

is called even when the engine is not in play mode. The issues I’m having are that when I quit play mode and then hit play again, the audio plugin stops responding to my custom events (in this case, note on and note off messages). I have to unload the plugin and reload it do get it to function again.

I’ve seen in the PluginInterface.h file a callback called:

UnityAudioEffect_ResetCallback reset; // The reset callback is called by the user to bring back the plugin instance into its initial state. Use to avoid clicks or artifacts.

This seems like what I need to do when the engine is not in play mode, so I can reset the plug in and when the engine is in play mode again - start any processing again from scratch.

However, I’m struggling to understand how to invoke this reset call back, does anybody know whether this is from the native C++ code or from within Unity that I call it and what form the callback has to be for it to work or how it is triggered by Unity?

Any help would be greatly appreciated!

Hi I am facing the same issue with my native audio plugin development. have you found a solution for this?. I have a work around where i load an empty audio file into the audio source linked to the mixer and set it in loop. so now every time i reset play my plugin works properly . its not ideal but it works. please let me know if you have figured out a proper solution for this. thanks. ,Hi I am facing the same issue. Have you found a solution for this problem?