Thanks for uploading your code!
I can see what you mean by having issues with the plugin when traversing the DSP graph. My expectation that you could call setParameter functions on the “FMOD Resampler” was incorrect, so you have my apology for that - it seems that the actual custom DSP is stored as an independent subgraph that is connected to the resampler, and cannot be accessed by the normal means of traversing the DSP graph.
That said, using an event callback will give you direct access to your Plugin DSP fairly simply. I have created a struct as follows in the UE header to pass to the event as user data:
struct UserData {
FMOD::DSP* pluginDSP;
};
const UserData userData;
As well as the following static event callback, which retrieves the DSP when it is created, and passes it to the user data struct:
FMOD_RESULT F_CALLBACK UEngineTest::EventCallback(FMOD_STUDIO_EVENT_CALLBACK_TYPE type, FMOD_STUDIO_EVENTINSTANCE* event, void* parameters) {
if (type == FMOD_STUDIO_EVENT_CALLBACK_PLUGIN_CREATED) {
UserData* userData;
((FMOD::Studio::EventInstance*)event)->getUserData((void**) &userData);
userData->pluginDSP = (FMOD::DSP*)(((FMOD_STUDIO_PLUGIN_INSTANCE_PROPERTIES*)parameters)->dsp);
}
return FMOD_OK;
}
I have appended the following code to the end of your code in the if (AudioComp == nullptr) check in UEngineTest::TickComponent(), which assigns the User Data struct and Callback to the AudioComponent’s underlying Event Instance:
if (AudioComp == nullptr) {
//....
AudioComp->StudioInstance->setCallback(EventCallback);
void* userDataPointer = (void*)&userData;
AudioComp->StudioInstance->setUserData(userDataPointer);
}
And finally, I’ve set the RPM parameter on the retrieved plugin DSP at the end of UEngineTest::TickComponent() with the following code:
//...
if (userData.pluginDSP != nullptr) {
userData.pluginDSP->setParameterFloat(0, 5000);
}
With this code, I am successfully able to retrieve the plugin DSP and set all parameters on it without any issue. Please give a shot on your and see whether you can access your DSP plugin in code - if so, you can omit traversing the DSP graph entirely.