diff options
author | Christopher Arndt <chris@chrisarndt.de> | 2018-10-20 23:48:21 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2018-10-21 01:08:09 +0200 |
commit | 8e25b4d193fb4fb9efbf7a7145d27879dcd668be (patch) | |
tree | b6a9ac5e2f3ed822d7e8be90ff5dc4264ae01839 /libs/ardour/vst_plugin.cc | |
parent | 83a0b1e3a874e1476ef1eca62e5c3976641235ae (diff) |
Add plugin version and parameter count to VST user presets
Signed-off-by: Christopher Arndt <chris@chrisarndt.de>
Diffstat (limited to 'libs/ardour/vst_plugin.cc')
-rw-r--r-- | libs/ardour/vst_plugin.cc | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/libs/ardour/vst_plugin.cc b/libs/ardour/vst_plugin.cc index 6cb412db39..9832b81b72 100644 --- a/libs/ardour/vst_plugin.cc +++ b/libs/ardour/vst_plugin.cc @@ -540,22 +540,28 @@ VSTPlugin::do_save_preset (string name) sha1_result_hash (&s, hash); string const uri = string_compose (X_("VST:%1:x%2"), unique_id (), hash); + string const str_ver = std::to_string (version ()); + string const num_params = std::to_string (parameter_count ()); if (_plugin->flags & 32 /* effFlagsProgramsChunks */) { - p = new XMLNode (X_("ChunkPreset")); - p->set_property (X_("uri"), uri); - p->set_property (X_("label"), name); + } else { + p = new XMLNode (X_("Preset")); + } + + p->set_property (X_("uri"), uri); + p->set_property (X_("version"), str_ver); + p->set_property (X_("label"), name); + p->set_property (X_("numParams"), num_params); + + if (_plugin->flags & 32) { + gchar* data = get_chunk (true); p->add_content (string (data)); g_free (data); } else { - p = new XMLNode (X_("Preset")); - p->set_property (X_("uri"), uri); - p->set_property (X_("label"), name); - for (uint32_t i = 0; i < parameter_count(); ++i) { if (parameter_is_input (i)) { XMLNode* c = new XMLNode (X_("Parameter")); @@ -761,6 +767,12 @@ VSTPlugin::label () const return _handle->name; } +int32_t +VSTPlugin::version () const +{ + return _plugin->version; +} + uint32_t VSTPlugin::parameter_count () const { |