Actually i don’t know how to start but i really need a reliable way to do this
I have my own preset manager.(I think mention this in my topics a lot ) I am able to save and load presets but i have some problems about the “correct time” to save or load them.
Normally every time my plugin is loaded, it checks a variable that is created and increased only once in the constructor of the processor. Every time the editor is closed it is again being increased on the editor side.
in the processor constructor:
in the editor deconstructor
So if this variable is smaller than 2, it means that this is the first time that processor is initialized. Then go to preset folder, read the default preset and load it.
if it is larger then 2, it means that the plugin window has been closed and re-opened. So do not load the default preset. Go with the last state.
For the scenario above, it works, But if user closes the DAW without saving the preset in my preset manager but save the host state(it means that the last state of my plugin also should be memorized and kept for the next run), since my plugin will check the creationCounter(it will be 1 because processor was destroyed when the user closed the host), it will load the default preset. if i knew if the user saved or did not save the host state, i would be able to do somethings for it but i think i cannot know that.
So my question is how should i deal with these kind of issues? Do you have any different approaches?
Mine looks very primitive, i am sure that there are better ones. What do you think ?
Thanks in advance.