Hi, I’m developing a plugin and I don’t know why when I load one instance on studio, I debug my code and it calls create, setDataParameter and release multiple times (about 10), and this crashes my flow.
I made a blank project, using only 1 event, with 1 track, and instancing my plugin on pre-fader, also setting max-instances of that event to 1 (just for try), but it continues to call create a lot of times.
Can you tell me what’s happening with those callbacks?
I have a similar issue where its not calling the creation callback on creating a user defined DSP with either System::createDSP() or System::createDSPByPlugin() (Core API)… A fix for these issues would be nice.
The worst part is for setDataParameter, because I have a bunch of data reading there, and every time I move another setFloatParameter knob I have on the plugin, the setDataParameter is calling and it tries to load again all the info.
It seems like every change on a parameter affects to all callbacks. Also creation and destruction has problems about it as @Sunkin351 says.
If you are fine with debugging C# code in Visual Studio, I’ll be glad to give you the code I use to reproduce it not calling the creation callback…
It leaves the plugin state uninitialized causing a debug assertion on line 33, or a NullReferenceException on line 47. (Or on line 253, due to the multi-threaded environment setup within FMOD.)
Though to be fair, I just ported the C++ example to C#, so you’d probably get the same problems there.
Edit: I even put a breakpoint in the Creation Callback to make sure it wasn’t being called on DSP creation.
I wrote the C# wrapper I’m using… FmodAudio. Much research went into its construction. If you wanna check my work, by all means. Me and OP both have similar issues with FMOD dsp callbacks.
Newest patch seems to have fixed it. Though, one issue remains. FMOD_DSP_STATE::instance is invalid by the time FMOD_DSP_DESCRIPTION::release is called? Why’s this?
I am not. The handle is as it always was on my end.
Another small detail: Is the FMOD_DSP_DESCRIPTION::release callback decoupled at all from FMOD_DSP_Release()? In my wrapper, I’m releasing a resource right after but that resource is needed from the callback… (In short, my resource is unavailable by the time the callback is called…)
Edit: That could be why the handle is invalid by the time the callback is called.
Calling FMOD_DSP_Release will cause the release callback set in the FMOD_DSP_DESCRIPTION to be called, at which point the instance will still be valid.
In the end, I was able to get everything working, and find out an important piece of information regarding DSP release/destruction. The release callback is decoupled from FMOD_DSP_Release() and is called at some later point in time. Not knowing this caused me some issues. But all is well.
I have a similar issue where the Create callback is called whenever I change any parameter. To make sure it’s not just happening in my own plugin project, I simply added
FMOD_DSP_LOG(dsp_state, FMOD_DEBUG_LEVEL_LOG, "Create_Callback", "Create_Callback is just called");
to FMOD_Gain_dspcreate() in the example fmod_gain project, and it’s doing the same thing.
Here’s the logs that I’ve been getting whenever I move the gain knob.
23:42:30 Macro: Set Gain [#2 times]
23:42:30 fmod_gain.cpp(212), Create_Callback(): Create_Callback is just called
23:42:30 fmod_bank_loader.cpp(125), Manager::readBank(): fileversion = 141, compatVersion = 140 (oldest = 44, newest = 141)
23:42:30 Macro: Set Gain
23:42:30 fmod_gain.cpp(212), Create_Callback(): Create_Callback is just called
23:42:30 fmod_bank_loader.cpp(125), Manager::readBank(): fileversion = 141, compatVersion = 140 (oldest = 44, newest = 141)
23:42:30 Macro: Set Gain [#3 times]
23:42:30 fmod_gain.cpp(212), Create_Callback(): Create_Callback is just called
23:42:30 fmod_bank_loader.cpp(125), Manager::readBank(): fileversion = 141, compatVersion = 140 (oldest = 44, newest = 141)
I have not been able to reproduce this myself, although if you are using Live Update then the Studio API might be instantiating the DSP each time it’s touched.