+string
+VSTPlugin::do_save_preset (string name)
+{
+ boost::shared_ptr<XMLTree> t (presets_tree ());
+ if (t == 0) {
+ return "";
+ }
+
+ XMLNode* p = 0;
+ /* XXX: use of _presets.size() + 1 for the unique ID here is dubious at best */
+ string const uri = string_compose (X_("VST:%1:%2"), unique_id (), _presets.size() + 1);
+
+ if (_plugin->flags & 32 /* effFlagsProgramsChunks */) {
+
+ p = new XMLNode (X_("ChunkPreset"));
+ p->add_property (X_("uri"), uri);
+ p->add_property (X_("label"), name);
+ gchar* data = get_chunk (true);
+ p->add_content (string (data));
+ g_free (data);
+
+ } else {
+
+ p = new XMLNode (X_("Preset"));
+ p->add_property (X_("uri"), uri);
+ p->add_property (X_("label"), name);
+
+ for (uint32_t i = 0; i < parameter_count(); ++i) {
+ if (parameter_is_input (i)) {
+ XMLNode* c = new XMLNode (X_("Parameter"));
+ c->add_property (X_("index"), string_compose ("%1", i));
+ c->add_property (X_("value"), string_compose ("%1", get_parameter (i)));
+ p->add_child_nocopy (*c);
+ }
+ }
+ }
+
+ t->root()->add_child_nocopy (*p);
+
+ std::string f = Glib::build_filename (ARDOUR::user_config_directory (), "presets");
+ f = Glib::build_filename (f, presets_file ());
+
+ t->write (f);
+ return uri;
+}
+
+void
+VSTPlugin::do_remove_preset (string name)
+{
+ boost::shared_ptr<XMLTree> t (presets_tree ());
+ if (t == 0) {
+ return;
+ }
+
+ t->root()->remove_nodes_and_delete (X_("label"), name);
+
+ std::string f = Glib::build_filename (ARDOUR::user_config_directory (), "presets");
+ f = Glib::build_filename (f, presets_file ());
+
+ t->write (f);
+}
+
+string
+VSTPlugin::describe_parameter (Evoral::Parameter param)