No Matches
Adding Factory Presets

Adding factory presets to your ASPiK plugin project is fairly straightforward. The PluginCore object contains a function named PluginCore::initPluginPresets( ) and you will need to create PresetInfo objects for each preset. This is easiest to explain with a few examples. You will need to:

  1. create a new PresetInfo object and give it a zero-based index value and a name string
  2. call the helper function initPresetParameters( ) to setup the object
  3. call setPresetParameter( ) for each PluginParameter object in your plugin, along with the control ID and value
  4. call the helper function addPreset( ) to add the object to the plugin's list

Here is a code example that will show you how it works - you only need to set the actual (not normalized) value for each parameter in the plugin:

// --- Plugin Presets
int index = 0;
PresetInfo* preset = nullptr;
// --- Preset: Factory Preset
preset = new PresetInfo(index++, "Factory Preset");
setPresetParameter(preset->presetParameters, controlID::volume_dB, 0.000000);
setPresetParameter(preset->presetParameters, controlID::enableMute, -0.000000);
setPresetParameter(preset->presetParameters, controlID::channels, -0.000000);
// --- Preset: MinusTwelve
preset = new PresetInfo(index++, "MinusTwelveLeft");
setPresetParameter(preset->presetParameters, controlID::volume_dB, -12.000000);
setPresetParameter(preset->presetParameters, controlID::enableMute, -0.000000);
setPresetParameter(preset->presetParameters, controlID::channels, 1.000);
return true;
size_t addPreset(PresetInfo *preset)
add a new preset
Definition: pluginbase.cpp:860
bool setPresetParameter(std::vector< PresetParameter > &presetParameters, uint32_t _controlID, double _controlValue)
set a new value for a preset
Definition: pluginbase.cpp:822
bool initPresetParameters(std::vector< PresetParameter > &presetParameters, bool disableSmoothing=true)
creates the preset parameter ID/Value pair PresetParameter objects and adds them to supplied list
Definition: pluginbase.cpp:800
bool initPluginPresets()
use this method to add new presets to the list
Definition: plugincore.cpp:676
Definition: pluginstructures.h:407
std::vector< PresetParameter > presetParameters
list of parameters for this preset
Definition: pluginstructures.h:427

If your plugin has a large number of parameters, you can use a built-in ASPiK exclusive to add a button to your GUI that will write a .txt file that contains the above code for one complete preset. You can then copy and paste that code right into your project. See the Plugin GUI section for more information on using this helper control.