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 ae4604a24b), simple
sequential numbering is no longer an option.
This commit is contained in:
Robin Gareus
2018-12-03 20:45:06 +01:00
parent 6877ac820b
commit b285559767

View File

@@ -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<uint32_t> (_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));
}