diff options
author | Hans Baier <hansfbaier@googlemail.com> | 2008-12-23 06:03:45 +0000 |
---|---|---|
committer | Hans Baier <hansfbaier@googlemail.com> | 2008-12-23 06:03:45 +0000 |
commit | e9a9fe30cf8661aeb48b5392d5e8f5c3f432b809 (patch) | |
tree | 471dca8335157be6136cbb1f3bcbdf8e2a4eadf7 /libs/ardour | |
parent | e6c2f03ca1200381f379da8e84f8068d2901bbaf (diff) |
* added comments to midi_region_view.h
* implemented choosing patches with context menu on the program change flag
* added convenience method and a little refactoring in midi_patch_manager.h
Conflicts:
.cproject
build-tmp.sh
git-svn-id: svn://localhost/ardour2/branches/3.0@4338 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour')
-rw-r--r-- | libs/ardour/ardour/midi_patch_manager.h | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/libs/ardour/ardour/midi_patch_manager.h b/libs/ardour/ardour/midi_patch_manager.h index f617d82998..10d0f99a7a 100644 --- a/libs/ardour/ardour/midi_patch_manager.h +++ b/libs/ardour/ardour/midi_patch_manager.h @@ -63,18 +63,31 @@ public: boost::shared_ptr<MasterDeviceNames> master_device_by_model(std::string model_name) { return _master_devices_by_model[model_name]; } + boost::shared_ptr<ChannelNameSet> find_channel_name_set( + string model, + string custom_device_mode, + uint8_t channel) { + 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); + } else { + return boost::shared_ptr<ChannelNameSet>(); + } + } + + 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); + boost::shared_ptr<ChannelNameSet> channel_name_set = find_channel_name_set(model, custom_device_mode, channel); - 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); + if (channel_name_set) { + return channel_name_set->find_patch(patch_key); } else { return boost::shared_ptr<Patch>(); } @@ -86,12 +99,10 @@ public: uint8_t channel, PatchPrimaryKey patch_key) { - boost::shared_ptr<MIDI::Name::MasterDeviceNames> master_device = master_device_by_model(model); + boost::shared_ptr<ChannelNameSet> channel_name_set = find_channel_name_set(model, custom_device_mode, channel); - if (master_device != 0 && custom_device_mode != "") { - return master_device-> - channel_name_set_by_device_mode_and_channel(custom_device_mode, channel)-> - previous_patch(patch_key); + if (channel_name_set) { + return channel_name_set->previous_patch(patch_key); } else { return boost::shared_ptr<Patch>(); } @@ -103,12 +114,10 @@ public: uint8_t channel, PatchPrimaryKey patch_key) { - boost::shared_ptr<MIDI::Name::MasterDeviceNames> master_device = master_device_by_model(model); + boost::shared_ptr<ChannelNameSet> channel_name_set = find_channel_name_set(model, custom_device_mode, channel); - if (master_device != 0 && custom_device_mode != "") { - return master_device-> - channel_name_set_by_device_mode_and_channel(custom_device_mode, channel)-> - next_patch(patch_key); + if (channel_name_set) { + return channel_name_set->next_patch(patch_key); } else { return boost::shared_ptr<Patch>(); } |