Working with plugin in DAW (workflow)

Hello,
I’m just confused myself. Hope somebody can help.

I have a plugin. It has presets menu with save button (if user change something, he can save the State as xml file). I have two methods for loading and saving presets. I’m not using getStateInformation and setStateInformation. Every time when I open the plugin I check the current preset and load State from the xml file. It works fine if we talk about Standalone.

But what is an idea behind DAW working.
Just simple use case.

  1. Open DAW project.
  2. Add plugin.
  3. Load preset.
  4. Close plugin UI (nor remove the whole plugin).
  5. Open plugin UI again.

Result: everything is reloading what is logical with my code. But how to prevent it?
I don’t want to reinitialize the plugin if I just closing plugin’s UI.

Thank you.

Anyone?
I thought it’s a trivial question. Many of you has an experience in it.
Will be grateful for any tips.

Although I don’t fully understand your question, I guess you can return the state of the plug-in from setStateInformation to the host.
When a user quits the DAW after changing the plug-in state without saving that to a preset, the user expects the state to be recalled when reloading the session.

I hope this is helpful to you, but if not, could you reformulate your question?

1 Like

It sounds like you are keeping the state in the editor, which is being reinitialised in the editor constructor. In a DAW the editor is created/destroyed every time you open/close the window. You should keep the state in the processor, as this survives the GUI being opened/closed.

edit: just noticed

You will need to use those for correct DAW behaviour.

1 Like

Think I’ve got it. Will try to fix.

Thank you!