Plugins And Threads

Hello, I took the fmod_gain example plugin to learn a few things about FMOD. I’m trying to set parameters inside my test program by calling dsp->setParameterFloat(FMOD_GAIN_PARAM_GAIN, -79.0f), however, when I step through the code, it seems like this function executes in the main thread, but when FMOD assigns an argument, it runs on its own thread. The effect of this is that when I try to modify the parameter it has no effect on the sound, it’s a if I have two plugins, one running on the main thread, another one running the FMOD thread (this one is the one doing the actual work). Any way I could modify parameters in the plugin running in the FMOD thread?

Thanks!

I should also mention I’m looking at the address of the variable m_target_gain, when this is set in the fmod thread, the address of this variable differs from the one that is set from the main thread by my program, so I think somehow I have two plugins running at the same time?

For those of you out there with the same problem I had, one way I managed to get this to work was to get the channel group the event belonged to, then from this group grab the DSP/Effect/Plugin, something like this:

event->getChannelGroup(&group);
group->getDSP(index, &dsp);

you can then use the dsp pointer to set parameters for the DSP in this event. I think my problem was that I was setting parameters for a different dsp which did not belong to this event.

I wish there were an easy way to figure out what index the dsp belongs to, anybody out there know the answer to this would be of great help.

Events, and the signal processing inside them, are meant to be opaque. The officially supported way to set a DSP parameter inside an event is to automate them on a parameter in the tool, and then set the parameter at runtime.

Otherwise don’t add the DSP in the tool instead add it to the channel group at runtime. Then you have no issues trying to find it inside the event.

Thanks Nicholas.