I’m currently doing it by calling beginEdit
followed by endEdit
(on a dummy parameter).
Is there a better way of doing it?
I need the DAW to immediately get the state and not until it quits.
I’ve tried IComponentHandler2::setDirty()
in Cubase, it returns kResultOk
but IComponent::getState
isn’t called. Whereas in REAPER it returns kResultFalse
.
The documentation is a little bit misleading. The call tells the host that the plug-in has some new state so that the host calls setState() whenever it saves the project/session or checks if it can close a project without save. If this is still not why you need a call to setState(), then please describe the use-case in detail.
My plugin is a host that loads other plugins. When the DAW loads my plugin it gets its state. Then, if the user loads a plugin inside my host, the DAW will still have the old state until the user changes something in the hosted plugin. This behavior causes my main issue: the first change to the hosted plugin can’t be undone. Since DAWs that support plugin UNDO, uses getState() and setState().
That’s exactly one of the use cases IComponentHandler2::setDirty
can be used for.
It now depends on the host if it supports this use case.
Hello
Should I call getState myself to save preset directly from my plugin or the VST3 does not support this and I should only write presets from DAW?
Normally the host will call setState/getState for saving project or preset.
Internally you could call setState/getState if you want to handle by yourself preset save/load.
It is recommended to let the host dealing with presets.