Saving & loading presets

Hello everyone,

I’ve already implemented savePluginState() and loadPluginState(), but now I’m trying to figure out how to allow the user of my plugin to save and load custom presets.

If I understand correctly, setCurrentProgram() should be used for this, right?

One thing that’s confusing me is, should preset saving/loading operations always be triggered from the host, or should the plugin’s GUI itself include controls for these things?

In Ableton, there are little “save preset” and “load preset” buttons :point_down: but I’m not sure if every host has this functionality.

Would the “load” button here trigger a call to setCurrentProgram()? Which function would the “save preset” button call – would that be getCurrentProgram()…?

Thanks for your help!

1 Like

The function getCurrentProgram() simply returns the index of the currently selected factory preset (at least in our plugin that actually makes use of programs), which we set in the setCurrentProgram() function. In the setCurrentProgram() function, we set that index, then load and apply the data from our internally-defined and maintained set of factory presets.

The save and load preset functions in the hosts (those which have them) simply call your getStateInformation() and setStateInformation() functions in order to fetch your Processor’s current state into the “chunk” or to apply the “chunk” data to your Processor’s state (exactly as if you were saving or loading a session, as opposed to a user preset). This is unrelated to the program, really.

Most of our plugins simply return 0 from getCurrentProgram(), and don’t make use of programs at all.

1 Like

OK I think I understand, thanks for the advice!

So if I’m going to implement a custom onboard preset selector in my plugin’s GUI, then I can pretty much leave getCurrentProgram() and setCurrentProgram() with their default boilerplate code, right?