ASPiK SDK
|
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:
• create a new PresetInfo object and give it a zero-based index value and a name string
• call the helper function initPresetParameters( ) to setup the object
• call setPresetParameter( ) for each PluginParameter object in your plugin, along with the control ID and value
• 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:
bool PluginCore::initPluginPresets()
{
// — Plugin Presets
int index = 0;
PresetInfo* preset = nullptr;
// — Preset: Factory Preset
preset = new PresetInfo(index++, "Factory Preset");
initPresetParameters(preset->presetParameters);
setPresetParameter(preset->presetParameters, controlID::volume_dB, 0.000000);
setPresetParameter(preset->presetParameters, controlID::enableMute, -0.000000);
setPresetParameter(preset->presetParameters, controlID::channels, -0.000000);
addPreset(preset);
// — Preset: MinusTwelve
preset = new PresetInfo(index++, "MinusTwelveLeft");
initPresetParameters(preset->presetParameters);
setPresetParameter(preset->presetParameters, controlID::volume_dB, -12.000000);
setPresetParameter(preset->presetParameters, controlID::enableMute, -0.000000);
setPresetParameter(preset->presetParameters, controlID::channels, 1.000);
addPreset(preset);
return true;
}
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.