Custom GUI for Preset Loading

gui

#1

Hi, I am looking into building a custom UI for preset loading, and wanted to ask about best practice.

I am looking to create something that can list the names of all the presets in a specified folder, and allow the user to save and load the presets without having to open a file browser.

If anyone has advice on the topic or can recommend some good resources or tutorials on this I would really appreciate it.

I currently have presets working in my plugin via the getStateInformation() and setStateInformation() using the interface that is built into programs like Ableton and Logic.

Thanks!


#2

Hi there, I do not think there is a “general tutorial” out there.
You can go from basic browsing to extreme management of preset categories/favorites/tags and whatnot.

Here is a brief list of my experience so far in “Custom Preset Management”:

Engine perspective :

  1. presets are xml representation of your AudioProcessorValueTreeState, plus xml content you might add or remove upon preset save/load e.g. :

you might decide not to save a “Mix Lock” parameter or a “Delay Freeze” parameter, because they are only used when the UI is open, so you remove those nodes before saving,
or:
you might want to add a plugin version to a preset, after you set Up your valueTreeState via:

valueTreeState->state.setProperty(“version”, JucePlugin_VersionString, nullptr);

  1. you can save/load those presets in many places - my cross platform(ish) choice is this :
File PresetManager::getUserPresetsFolder(){
    File rootFolder File::getSpecialLocation(File::SpecialLocationType::userApplicationDataDirectory);

#ifdef JUCE_MAC

    rootFolder = rootFolder.getChildFile("Audio").getChildFile("Presets");

#endif
rootFolder = rootFolder.getChildFile(companyName_).getChildFile(productName_);
Result res = rootFolder.createDirectory(); // creates if not existing
return rootFolder;
}

File PresetManager::getFactoryPresetsFolder(){
    File rootFolder = File::getSpecialLocation(File::SpecialLocationType::commonApplicationDataDirectory);

#if JUCE_MAC
rootFolder = rootFolder.getChildFile(“Audio”).getChildFile(“Presets”);
#endif
rootFolder = rootFolder.getChildFile(companyName_).getChildFile(productName_);
Result res = rootFolder.createDirectory();
return rootFolder;
}

PS: Look around in the forum for “GarageBand Sandboxing”, a topic I am aware of but I did not yet come to test.

  1. If you want to do A/B preset management you can hold 2 AudioProcessorValueTreeState XML strings in your preset manager, keeping the “Foreground” xml up to date with your user UI modification or DAW modulation before switching to the “Background” preset.

  2. when your preset Management becomes more complex, You must take care of additional logic in get/setStateInformation, in order to always load and save a full and correct state of your plugin. For example You might want to save and reload the “B” preset state as well :slight_smile:

UI Perspective:

  1. For a basic Preset Management UI , look no further than in the code for the homepage of the projucer!

there you have :

  • Project Name : an editable text box for the plugin name (edit: I mean the PRESET name ) - just reason about your desired use case for user vs. factory presets.
  • Project Type : maybe an initial implementation for a plugin category, or a User/Factory Selector?
  • Folder Browser : do you want your users to load plugins from elsewhere than the “User Presets” and “Factory Presets” folder?
  • Folder List : fill this with all the files with extension = yourpresetextension in your user/factory/designer/whatever folder. Use more lists if you want to show user AND factory at the same time
  1. for extended UIs (favourites/tags/iamfeelinglucky etc etc) I am not there yet so I can not help you right now. I too would love for someone to hand me the JUCE ready code for a preset manager as good as FXpansion Strobe2’s, but life is hard and I will have to make it on my own :slight_smile: