Sort VST factory presets
This is more of a workaround than a fix. Simply by forcing the URI to be sortable (VST-user presets are sorted at the end). This eventually needs a deeper cleanup and API consolidation PluginInfo::get_presets(bool) returns an ordered std::vector. However this API is only used in a few cases where the plugin is not instantiated. PluginInfo::get_presets(bool). The problem is Plugin::get_presets(). The method returns information that was previously cached by Plugin::find_presets() in std::map<URI, ...>
This commit is contained in:
@@ -125,11 +125,11 @@ LXVSTPluginInfo::get_presets (bool user_only) const
|
||||
int const vst_version = plugin->dispatcher (plugin, effGetVstVersion, 0, 0, NULL, 0);
|
||||
|
||||
for (int i = 0; i < plugin->numPrograms; ++i) {
|
||||
Plugin::PresetRecord r (string_compose (X_("VST:%1:%2"), unique_id, i), "", false);
|
||||
Plugin::PresetRecord r (string_compose (X_("VST:%1:%2"), unique_id, std::setw(4), std::setfill('0'), i), "", false);
|
||||
if (vst_version >= 2) {
|
||||
char buf[256];
|
||||
if (plugin->dispatcher (plugin, 29, i, 0, buf, 0) == 1) {
|
||||
r.label = buf;
|
||||
r.label = string_compose (_("%1 - %2"), i, buf);
|
||||
} else {
|
||||
r.label = string_compose (_("Preset %1"), i);
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ MacVSTPluginInfo::get_presets (bool user_only) const
|
||||
int const vst_version = plugin->dispatcher (plugin, effGetVstVersion, 0, 0, NULL, 0);
|
||||
|
||||
for (int i = 0; i < plugin->numPrograms; ++i) {
|
||||
Plugin::PresetRecord r (string_compose (X_("VST:%1:%2"), unique_id, i), "", false);
|
||||
Plugin::PresetRecord r (string_compose (X_("VST:%1:%2"), unique_id, std::setw(4), std::setfill('0'), i), "", false);
|
||||
if (vst_version >= 2) {
|
||||
char buf[256];
|
||||
if (plugin->dispatcher (plugin, 29, i, 0, buf, 0) == 1) {
|
||||
|
||||
@@ -840,7 +840,8 @@ VSTPlugin::find_presets ()
|
||||
|
||||
int const vst_version = _plugin->dispatcher (_plugin, effGetVstVersion, 0, 0, NULL, 0);
|
||||
for (int i = 0; i < _plugin->numPrograms; ++i) {
|
||||
PresetRecord r (string_compose (X_("VST:%1:%2"), unique_id (), i), "", false);
|
||||
|
||||
PresetRecord r (string_compose (X_("VST:%1:%2"), unique_id (), std::setw(4), std::setfill('0'), i), "", false);
|
||||
|
||||
if (vst_version >= 2) {
|
||||
char buf[256];
|
||||
|
||||
Reference in New Issue
Block a user