summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorHans Baier <hansfbaier@googlemail.com>2008-12-14 22:56:44 +0000
committerHans Baier <hansfbaier@googlemail.com>2008-12-14 22:56:44 +0000
commitbf7e792e3e499b665c20fc196e53cf05bb99e0c7 (patch)
tree625a115862898cbc6654093693f72e10ea60660c /libs
parent18d6284438bb69655670a7b1e931cd73f35d00d8 (diff)
* some refactoring of patch name stuff in preparation for altering program changes events
git-svn-id: svn://localhost/ardour2/branches/3.0@4323 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/ardour/midi_patch_manager.h17
-rw-r--r--libs/midi++2/midi++/midnam_patch.h17
-rw-r--r--libs/midi++2/midnam_patch.cc1
3 files changed, 31 insertions, 4 deletions
diff --git a/libs/ardour/ardour/midi_patch_manager.h b/libs/ardour/ardour/midi_patch_manager.h
index 9a99571f79..1642b1a22b 100644
--- a/libs/ardour/ardour/midi_patch_manager.h
+++ b/libs/ardour/ardour/midi_patch_manager.h
@@ -63,6 +63,23 @@ public:
boost::shared_ptr<MasterDeviceNames> master_device_by_model(std::string model_name)
{ return _master_devices_by_model[model_name]; }
+ boost::shared_ptr<Patch> find_patch(
+ string model,
+ string custom_device_mode,
+ uint8_t channel,
+ PatchPrimaryKey patch_key) {
+
+ boost::shared_ptr<MIDI::Name::MasterDeviceNames> master_device = master_device_by_model(model);
+
+ if (master_device != 0 && custom_device_mode != "") {
+ return master_device->
+ channel_name_set_by_device_mode_and_channel(custom_device_mode, channel)->
+ find_patch(patch_key);
+ } else {
+ return boost::shared_ptr<Patch>();
+ }
+ }
+
std::list<string> custom_device_mode_names_by_model(std::string model_name) {
if (model_name != "") {
return master_device_by_model(model_name)->custom_device_mode_names();
diff --git a/libs/midi++2/midi++/midnam_patch.h b/libs/midi++2/midi++/midnam_patch.h
index 7570a9f84d..1fa73a56b6 100644
--- a/libs/midi++2/midi++/midnam_patch.h
+++ b/libs/midi++2/midi++/midnam_patch.h
@@ -151,11 +151,20 @@ public:
return _available_for_channels.find(channel) != _available_for_channels.end();
}
- boost::shared_ptr<Patch> find_patch(uint8_t msb, uint8_t lsb, uint8_t program_number) {
- PatchPrimaryKey key(msb, lsb, program_number);
+ boost::shared_ptr<Patch> find_patch(PatchPrimaryKey& key) {
assert(key.is_sane());
return _patch_map[key];
}
+
+ boost::shared_ptr<Patch> previous_patch(PatchPrimaryKey& key) {
+ assert(key.is_sane());
+ return (*(--_patch_map.find(key))).second;
+ }
+
+ boost::shared_ptr<Patch> next_patch(PatchPrimaryKey& key) {
+ assert(key.is_sane());
+ return (*(++_patch_map.find(key))).second;
+ }
XMLNode& get_state (void);
int set_state (const XMLNode& a_node);
@@ -266,8 +275,8 @@ public:
return _channel_name_sets[custom_device_mode_by_name(mode)->channel_name_set_name_by_channel(channel)];
}
- boost::shared_ptr<Patch> find_patch(string mode, uint8_t channel, uint8_t msb, uint8_t lsb, uint8_t program_number) {
- return channel_name_set_by_device_mode_and_channel(mode, channel)->find_patch(msb, lsb, program_number);
+ boost::shared_ptr<Patch> find_patch(string mode, uint8_t channel, PatchPrimaryKey& key) {
+ return channel_name_set_by_device_mode_and_channel(mode, channel)->find_patch(key);
}
XMLNode& get_state (void);
diff --git a/libs/midi++2/midnam_patch.cc b/libs/midi++2/midnam_patch.cc
index 7f17d8de3c..555e19fc63 100644
--- a/libs/midi++2/midnam_patch.cc
+++ b/libs/midi++2/midnam_patch.cc
@@ -78,6 +78,7 @@ Patch::set_state (const XMLNode& node)
}
}
+ //cerr << "deserialized Patch: name: " << _name << _id.msb << " lsb: " << _id.lsb << " program " << _id.program_number << endl;
assert(_id.is_sane());
return 0;