I’ve got two plugins in my DAW on separate tracks. Both are on the same user preset.
In one of the plugins I delete that user preset.
Do you communicate to the other instance that a preset has been deleted (inter-instance communication), or do a periodic check, shared data, or something else?
My plugin stores all the current presets (factory and user) in a vector. This vector is refreshed when the user clicks on the dropdown menu that displays the presets.
Personally I use the filesystem as the global source of truth - each preset is just a file saved in a certain directory, and deleting a preset would just be deleting a file.
In the second instance, you could have the preset list rescan/refresh when the editor is opened (or if you have a preset popup, then when that is opened), or you could periodically rescan on a timer (probably a bit wasteful), or you can use something like Gin’s FilesystemWatcher.
You could use a properties file and monitor that for changes. Other approaches are likely to run into issues with DAWs using any sort of plugin sandboxing or virtualization. But, IMO trying to link plugin instances together is fraught with peril and is likely to be confusing to the user.
I use a SharedResourcePointer so that there is only one list of presets that all plugins reference. However, FLStudio can run each instance in a separate process, or the user could load VST2 and VST3, so it’s not foolproof.
Do you find accessing the filesystem is time a time burden? My plugin can “cycle” through" presets, I’m wondering if it has to refresh by looking at the file system every time it does that that will put a time strain on in. I can test that out. Anyway, I resonate with your idea that the file system is the global source of truth.