diff options
author | Robin Gareus <robin@gareus.org> | 2015-12-25 16:20:53 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2015-12-25 17:12:37 +0100 |
commit | b92f208b521f0e733b123ef5e7552ee26b4d439d (patch) | |
tree | df241ca594caa904d43a407cb8ff6afb850480fb /libs/ardour | |
parent | a8159326b85a6c86ac7a0108b8c9468b7ff23502 (diff) |
don't assume plugin presets start their numbering at zero.
Diffstat (limited to 'libs/ardour')
-rw-r--r-- | libs/ardour/ardour/plugin.h | 10 | ||||
-rw-r--r-- | libs/ardour/audio_unit.cc | 2 | ||||
-rw-r--r-- | libs/ardour/instrument_info.cc | 6 | ||||
-rw-r--r-- | libs/ardour/vst_plugin.cc | 4 |
4 files changed, 9 insertions, 13 deletions
diff --git a/libs/ardour/ardour/plugin.h b/libs/ardour/ardour/plugin.h index 008e88bf78..72eda4c2fd 100644 --- a/libs/ardour/ardour/plugin.h +++ b/libs/ardour/ardour/plugin.h @@ -144,17 +144,17 @@ class LIBARDOUR_API Plugin : public PBD::StatefulDestructible, public Latent void monitoring_changed (); struct PresetRecord { - PresetRecord () : number (-1), user (true) {} - PresetRecord (const std::string& u, const std::string& l, int n = -1, bool s = true) : uri (u), label (l), number (n), user (s) {} + PresetRecord () : valid (false) {} + PresetRecord (const std::string& u, const std::string& l, bool s = true) : uri (u), label (l), user (s), valid (true) {} bool operator!= (PresetRecord const & a) const { - return number != a.number || uri != a.uri || label != a.label; + return uri != a.uri || label != a.label; } std::string uri; std::string label; - int number; // if <0, invalid bool user; + bool valid; }; PresetRecord save_preset (std::string); @@ -335,8 +335,8 @@ struct PluginPreset { if (preset) { _preset.uri = preset->uri; _preset.label = preset->label; - _preset.number = preset->number; _preset.user = preset->user; + _preset.valid = preset->valid; } } }; diff --git a/libs/ardour/audio_unit.cc b/libs/ardour/audio_unit.cc index 9967a1c664..936113d26e 100644 --- a/libs/ardour/audio_unit.cc +++ b/libs/ardour/audio_unit.cc @@ -2327,7 +2327,7 @@ AUPlugin::find_presets () for (FactoryPresetMap::iterator i = factory_preset_map.begin(); i != factory_preset_map.end(); ++i) { /* XXX: dubious */ string const uri = string_compose ("%1", _presets.size ()); - _presets.insert (make_pair (uri, Plugin::PresetRecord (uri, i->first, 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)); } } diff --git a/libs/ardour/instrument_info.cc b/libs/ardour/instrument_info.cc index c673170b72..c30994befc 100644 --- a/libs/ardour/instrument_info.cc +++ b/libs/ardour/instrument_info.cc @@ -175,12 +175,8 @@ InstrumentInfo::plugin_programs_to_channel_name_set (boost::shared_ptr<Processor std::vector<Plugin::PresetRecord>::iterator i; int n; - /* XXX note the assumption that plugin presets start their numbering at - * zero - */ - for (n = 0, i = presets.begin(); i != presets.end(); ++i, ++n) { - if ((*i).number >= 0) { + if ((*i).valid) { patch_list.push_back (boost::shared_ptr<Patch> (new Patch ((*i).label, n))); } else { patch_list.push_back (boost::shared_ptr<Patch> (new Patch (string_compose ("program %1", n), n))); diff --git a/libs/ardour/vst_plugin.cc b/libs/ardour/vst_plugin.cc index 1614b1d8fe..f04aa2bce1 100644 --- a/libs/ardour/vst_plugin.cc +++ b/libs/ardour/vst_plugin.cc @@ -679,7 +679,7 @@ 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), "", -1, false); + PresetRecord r (string_compose (X_("VST:%1:%2"), unique_id (), i), "", false); if (vst_version >= 2) { char buf[256]; @@ -709,7 +709,7 @@ VSTPlugin::find_presets () assert (uri); assert (label); - PresetRecord r (uri->value(), label->value(), -1, true); + PresetRecord r (uri->value(), label->value(), true); _presets.insert (make_pair (r.uri, r)); } } |