Set an external plugin param, and guarantee that the plugin state is updated

I’ve noticed that some (but not all) externally hosted plugins, including the #T Daw Essentials VST2s throttle parameter updates. For example, I do the following on the message thread, the saved edit does not include the updated plugin parameter.

tePlugin->getAutomatableParameterByID("someID")->setParameter(0.5, NotificationType::sendNotification)
te::EditFileOperations(*edit).save(true, true, false);

Is it possible to flush the plugin parameter’s state so I can save the underlying ValueTree with confidence? I tried using tePlugin->flushPluginStateToValueTree(), but the results are the same.

Alternatively, is there any way to know when the plugin’s state had been updated, and it is ready to be saved?

I noticed that with the DAW Essentials plugins like #TStereoDelay, if I wait approximately 10 milliseconds after setting a parameter, I can safely save the edit – but it would be nice if there were a less hacky way of saving, especially since not all VST plugins require this delay.

I think the issue is the juce Value Tree params don’t update the Value Tree right away. I’d need to dig into it and see why. I can’t think of any safe way around this other than wait.

Can I just verify that this isn’t a problem with Tracktion Engine but with the DAW Essentials (and maybe other juce::APVTS based) plugins?

If so, we should probably flush any pending updates to the ValueTree state in getStateInformation if it’s possible to the that with the APVTS. It’s been so long since I’ve done anything plugin related I can’t remember.

Can I ask what the use case is? Both out of curiosity and in case there’s another way of doing what you need.

@RolandMR Interestingly, waiting 10 milliseconds is not needed with some VSTs, for example, U-He Zebra2 VST2. So the parameters do update immediately sometimes. I was assuming that my issue is inside the plugin for that reason. I also don’t know the VST API at all, and I could be wrong.

@dave96 Sure! The immediate goal is procedurally generating and saving present and session templates. The high-level goal is creating a scriptable language for sound design, kind of like a musical score, but for digital sound design techniques. This is part of my dissertation work at uni. :slight_smile:

I’m not totally sure, but I think this is an issue with certain plugins, not tracktion_engine – unless the VST2 API includes some way to tell plugins to flush their state. I’m looking into that now.

I think you might just have to wait a bit of time until saving as we can’t guarantee the behaviour of all plugins. We might be able to fix it in our own plugins but we can’t guarantee this won’t happen with other 3rd party plugins.

Got it. Thanks for letting me know.

@dave96 Do you think you update the DAW Essentials plugins at some point so they flush pending update in getStateInformation? It would be helpful for me to know if I can expect that eventually, even if I know that other external plugins make no guarantees.

FWIW, I have tested and observed the behavior in #TReverber8, #TEqualiser, #TStereoDelay, and #TCompressor on both Linux and MacOS. I have not tested the other DAW Essentials plugins.

I can but I’m not sure when we’ll be able to get to it, I’m really slammed with a ton of other stuff right now.

Are you only using the DAW Essentials plugins though? My point was that if other plugins have this problem you’ll need to work around all of them by adding the delay anyway.

Got it. The other plugins I’m using so far haven’t needed the delay – I’m still deciding the range of plugins I want to support. Thanks for the info!

I do really like the DAW Essentials plugins for their blend of quality, simplicity, and portability. There aren’t a lot of channel strip plugins that work on Mac/Win/Linux.