From e9a9fe30cf8661aeb48b5392d5e8f5c3f432b809 Mon Sep 17 00:00:00 2001 From: Hans Baier Date: Tue, 23 Dec 2008 06:03:45 +0000 Subject: * 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 --- libs/ardour/ardour/midi_patch_manager.h | 39 ++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 15 deletions(-) (limited to 'libs/ardour/ardour') 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 master_device_by_model(std::string model_name) { return _master_devices_by_model[model_name]; } + boost::shared_ptr find_channel_name_set( + string model, + string custom_device_mode, + uint8_t channel) { + boost::shared_ptr 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(); + } + } + + boost::shared_ptr find_patch( string model, string custom_device_mode, uint8_t channel, PatchPrimaryKey patch_key) { - boost::shared_ptr master_device = master_device_by_model(model); + boost::shared_ptr 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(); } @@ -86,12 +99,10 @@ public: uint8_t channel, PatchPrimaryKey patch_key) { - boost::shared_ptr master_device = master_device_by_model(model); + boost::shared_ptr 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(); } @@ -103,12 +114,10 @@ public: uint8_t channel, PatchPrimaryKey patch_key) { - boost::shared_ptr master_device = master_device_by_model(model); + boost::shared_ptr 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(); } -- cgit v1.2.3