diff options
author | Carl Hetherington <carl@carlh.net> | 2009-10-21 00:21:02 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2009-10-21 00:21:02 +0000 |
commit | e1980eb495c9682794be28cad8bd15b37806d8c3 (patch) | |
tree | 3c83e2e9f0825627dbcc0dbe46a9b26a30766cbf | |
parent | bc56eb8bd73c7b456b646ba0cc627d449baa37f2 (diff) |
Fix creation of plugin presets.
git-svn-id: svn://localhost/ardour2/branches/3.0@5836 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | libs/ardour/ardour/plugin.h | 4 | ||||
-rw-r--r-- | libs/ardour/plugin.cc | 14 |
2 files changed, 9 insertions, 9 deletions
diff --git a/libs/ardour/ardour/plugin.h b/libs/ardour/ardour/plugin.h index aeec4ee32e..f686dd2e0c 100644 --- a/libs/ardour/ardour/plugin.h +++ b/libs/ardour/ardour/plugin.h @@ -136,7 +136,7 @@ class Plugin : public PBD::StatefulDestructible, public Latent virtual bool parameter_is_input(uint32_t) const = 0; virtual bool parameter_is_output(uint32_t) const = 0; - virtual bool save_preset (std::string uri) = 0; + virtual bool save_preset (std::string) = 0; virtual bool load_preset (const std::string uri); struct PresetRecord { @@ -191,7 +191,7 @@ class Plugin : public PBD::StatefulDestructible, public Latent virtual void set_parameter (uint32_t which, float val) = 0; - bool save_preset (std::string uri, std::string domain /* vst, ladspa etc. */); + bool save_preset (std::string, std::string /* vst, ladspa etc. */); ARDOUR::AudioEngine& _engine; ARDOUR::Session& _session; diff --git a/libs/ardour/plugin.cc b/libs/ardour/plugin.cc index 6778a3af19..4971c57deb 100644 --- a/libs/ardour/plugin.cc +++ b/libs/ardour/plugin.cc @@ -161,7 +161,7 @@ Plugin::load_preset(const string preset_uri) } bool -Plugin::save_preset (string uri, string domain) +Plugin::save_preset (string name, string domain) { lrdf_portvalue portvalues[parameter_count()]; lrdf_defaults defaults; @@ -197,12 +197,12 @@ Plugin::save_preset (string uri, string domain) string source(string_compose("file:%1/.%2/rdf/ardour-presets.n3", envvar, domain)); - map<string,PresetRecord>::const_iterator pr = presets.find(uri); - if (pr == presets.end()) { - warning << _("Could not find preset ") << uri << endmsg; - return false; - } - free(lrdf_add_preset(source.c_str(), pr->second.label.c_str(), id, &defaults)); + char* uri = lrdf_add_preset (source.c_str(), name.c_str(), id, &defaults); + + /* XXX: why is the uri apparently kept as the key in the `presets' map and also in the PresetRecord? */ + + presets.insert (make_pair (uri, PresetRecord (uri, name))); + free (uri); string path = string_compose("%1/.%2", envvar, domain); if (g_mkdir_with_parents (path.c_str(), 0775)) { |