Skip to content

Adding presets

p0nce edited this page Jun 12, 2022 · 6 revisions

Dplug has no internal presets, instead it uses the preset mechanism in the plugin formats it implements.
Preset lists are exposed in the DAW UI.

This tutorial will show you how to add presets in your plugin in an efficient way.


STEP 1

Create presets one by one in a DAW that can save in the .fxp format.
The name of the preset is the file name.
Keep file names under 24 characters for good results.

Example:
More Bass.fxp will hold a preset named "More Bass" in the DAW.


STEP 2

Use tools/presetbank to create your .fxb bank. You can build a script that does this. A plugin build can have only one bank, so create several banks if you have several plugin configurations that needs different presets.

Example:

presetbank "Default.fxp" "Failling Down.fxp" "Here comes the bass.fxp" -o all-presets.fxb

Tip: If this fails with the message Expected FxCK it means you need a newer presetbank tool, in order to support a FXB with a Dplug chunk inside.


STEP 3 (OPTIONAL)

Add the bank directory in the "stringImportPaths" in your plug-in's dub.json.

Example:

{
    "stringImportPaths": ["presets"],
}

STEP 4

Override buildPresets() in your main.d:

override Preset[] buildPresets()
{
    return loadPresetsFromFXB(this, import("all-presets.fxb"), -1); // -1 for all presets, n for just the n first
}

Done! Your plug-in now have presets in all formats that Dplug supports.