From: Robin Gareus Date: Mon, 3 Dec 2018 19:45:06 +0000 (+0100) Subject: Consistent AU factory Preset IDs X-Git-Url: https://git.carlh.net/gitweb/?p=ardour.git;a=commitdiff_plain;h=b285559767e21aae4467270590f048c3263fd742 Consistent AU factory Preset IDs Use AU's preset->presetNumber as identifier since std::map are sorted this also indirectly sorts presets by preset-number. (user presets start with a '/' and are listed first, sorted by name). Since Presets are now identified by URI on session load (53a0199a0) and AU user-presets can added/be removed (since ae4604a24b7), simple sequential numbering is no longer an option. --- diff --git a/libs/ardour/audio_unit.cc b/libs/ardour/audio_unit.cc index 559961b0b2..31ef2c470e 100644 --- a/libs/ardour/audio_unit.cc +++ b/libs/ardour/audio_unit.cc @@ -2604,10 +2604,7 @@ AUPlugin::find_presets () /* add factory presets */ for (FactoryPresetMap::iterator i = factory_preset_map.begin(); i != factory_preset_map.end(); ++i) { - /* XXX: dubious -- deleting & re-adding a preset -> same URI - * good that we don't support deleting AU presets :) - */ - string const uri = PBD::to_string (_presets.size ()); + string const uri = string_compose ("AU2:%1", std::setw(4), std::setfill('0'), i->second); _presets.insert (make_pair (uri, Plugin::PresetRecord (uri, i->first, false))); DEBUG_TRACE (DEBUG::AudioUnits, string_compose("AU Adding Factory Preset: %1 > %2\n", i->first, i->second)); }