Questions about SerializeState/UnserializeState

Good morning, I have a couple of questions:

  • should overridden Unserialize/SerializeState methods be in IPLUG_DSP, IPLUG_EDITOR or global block ?
  • is any method in the UI/Editor thread called when a state has been un-/serialized, OnRestoreState look promising?
  • is IGraphics attached when all these methods are called ? (Seems not always)
  • may I call SendControlValueFromDelegate/SendArbitraryMsgFromDelegate from Unserialize/SerializeState methods to send an info to the UI/Editor ? Or what would be the right way to update the UI after unserializing custom data ?

Thank you !

first a reminder that IPLUG_EDITOR/IPLUG_DSP guards are only needed if you want to make a Web Audio Module, or a “distributed” VST3 plugin, other formats you don’t need to worry about these guards and it can make your code cleaner to remove them. The Unserialize/SerializeState methods need to exist at global level for the case of a “distributed” VST3 plugin, where the VST3 processor and controller need access to the state. I would advise against making a distributed VST3 at this stage if you don’t have a good reason

OnRestoreState() * i think *… been a while

Not necessarily

Yes those methods would be appropriate. Also SendControlMsgFromDelegate()