From 23350c195db2a8a777ca8d471174b44255c96ec4 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sun, 10 Jun 2012 16:42:17 +0000 Subject: remove craziness of propagating MIDI 7 bit limits into MIDNAM handling by replacing bank_msb/lsb with "bank" ; move responsibility for discovering patch names into MIDI trackview (soon to move again) git-svn-id: svn://localhost/ardour2/branches/3.0@12647 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/midi_time_axis.cc | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'gtk2_ardour/midi_time_axis.cc') diff --git a/gtk2_ardour/midi_time_axis.cc b/gtk2_ardour/midi_time_axis.cc index 7cebb806af..e8a2b1faff 100644 --- a/gtk2_ardour/midi_time_axis.cc +++ b/gtk2_ardour/midi_time_axis.cc @@ -324,8 +324,8 @@ MidiTimeAxisView::model_changed() void MidiTimeAxisView::custom_device_mode_changed() { - _midi_patch_settings_changed.emit (midi_patch_model (), midi_patch_custom_device_node ()); - set_gui_property (X_("midnam-custom-device-mode"), midi_patch_custom_device_node ()); + _midi_patch_settings_changed.emit (midi_patch_model (), midi_patch_custom_device_mode ()); + set_gui_property (X_("midnam-custom-device-mode"), midi_patch_custom_device_mode ()); } MidiStreamView* @@ -1214,7 +1214,26 @@ MidiTimeAxisView::midi_patch_model () const } string -MidiTimeAxisView::midi_patch_custom_device_node () const +MidiTimeAxisView::midi_patch_custom_device_mode () const { return _custom_device_mode_selector.get_active_text (); } + +string +MidiTimeAxisView::get_patch_name (uint16_t bank, uint8_t program, uint8_t channel) const +{ + MIDI::Name::PatchPrimaryKey patch_key (bank, program); + + boost::shared_ptr patch = + MIDI::Name::MidiPatchManager::instance().find_patch (midi_patch_model(), midi_patch_custom_device_mode(), channel, patch_key); + + if (patch) { + return patch->name(); + } else { + /* program and bank numbers are zero-based: convert to one-based: MIDI_BP_ZERO */ + +#define MIDI_BP_ZERO ((Config->get_first_midi_bank_is_zero())?0:1) + + return string_compose ("%1 %2",program + MIDI_BP_ZERO , bank + MIDI_BP_ZERO); + } +} -- cgit v1.2.3