summaryrefslogtreecommitdiff
path: root/libs/ardour
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2014-12-13 00:37:34 -0500
committerDavid Robillard <d@drobilla.net>2014-12-13 00:37:34 -0500
commitee38c44109bff63828dac220107f4b54c4a809a3 (patch)
tree46177171139a89e3aaa987f49d1beaba867b1351 /libs/ardour
parent17a58ecd4bdf0764f1d074a56743f2304bd713a7 (diff)
Structure MIDI device selector by manufacturer.
Unfortunately we store the state of models as simply model, so if there's ever duplicate model names, we're somewhat screwed, but this makes the (previously unmanageably huge) menu usable, while retaining the "model name as global identifier" state unmodified.
Diffstat (limited to 'libs/ardour')
-rw-r--r--libs/ardour/ardour/midi_patch_manager.h6
-rw-r--r--libs/ardour/midi_patch_manager.cc14
2 files changed, 19 insertions, 1 deletions
diff --git a/libs/ardour/ardour/midi_patch_manager.h b/libs/ardour/ardour/midi_patch_manager.h
index cd898aa00f..1b7de6a51d 100644
--- a/libs/ardour/ardour/midi_patch_manager.h
+++ b/libs/ardour/ardour/midi_patch_manager.h
@@ -46,7 +46,8 @@ private:
static MidiPatchManager* _manager;
public:
- typedef std::map<std::string, boost::shared_ptr<MIDINameDocument> > MidiNameDocuments;
+ typedef std::map<std::string, boost::shared_ptr<MIDINameDocument> > MidiNameDocuments;
+ typedef std::map<std::string, MIDINameDocument::MasterDeviceNamesList> DeviceNamesByMaker;
virtual ~MidiPatchManager() { _manager = 0; }
@@ -133,6 +134,8 @@ public:
const MasterDeviceNames::Models& all_models() const { return _all_models; }
+ const DeviceNamesByMaker& devices_by_manufacturer() const { return _devices_by_manufacturer; }
+
private:
void session_going_away();
void refresh();
@@ -140,6 +143,7 @@ private:
MidiNameDocuments _documents;
MIDINameDocument::MasterDeviceNamesList _master_devices_by_model;
+ DeviceNamesByMaker _devices_by_manufacturer;
MasterDeviceNames::Models _all_models;
};
diff --git a/libs/ardour/midi_patch_manager.cc b/libs/ardour/midi_patch_manager.cc
index ab66949326..e0638f035e 100644
--- a/libs/ardour/midi_patch_manager.cc
+++ b/libs/ardour/midi_patch_manager.cc
@@ -87,6 +87,12 @@ MidiPatchManager::add_session_patches ()
// build a list of all master devices from all documents
_master_devices_by_model[device->first] = device->second;
_all_models.insert(device->first);
+ const std::string& manufacturer = device->second->manufacturer();
+ if (_devices_by_manufacturer.find(manufacturer) == _devices_by_manufacturer.end()) {
+ MIDINameDocument::MasterDeviceNamesList empty;
+ _devices_by_manufacturer.insert(std::make_pair(manufacturer, empty));
+ }
+ _devices_by_manufacturer[manufacturer].insert(std::make_pair(device->first, device->second));
// make sure there are no double model names
// TODO: handle this gracefully.
@@ -102,6 +108,7 @@ MidiPatchManager::refresh()
_documents.clear();
_master_devices_by_model.clear();
_all_models.clear();
+ _devices_by_manufacturer.clear();
Searchpath search_path = midi_patch_search_path ();
vector<std::string> result;
@@ -133,6 +140,12 @@ MidiPatchManager::refresh()
_master_devices_by_model[device->first] = device->second;
_all_models.insert(device->first);
+ const std::string& manufacturer = device->second->manufacturer();
+ if (_devices_by_manufacturer.find(manufacturer) == _devices_by_manufacturer.end()) {
+ MIDINameDocument::MasterDeviceNamesList empty;
+ _devices_by_manufacturer.insert(std::make_pair(manufacturer, empty));
+ }
+ _devices_by_manufacturer[manufacturer].insert(std::make_pair(device->first, device->second));
}
}
@@ -148,4 +161,5 @@ MidiPatchManager::session_going_away ()
_documents.clear();
_master_devices_by_model.clear();
_all_models.clear();
+ _devices_by_manufacturer.clear();
}