summaryrefslogtreecommitdiff
path: root/gtk2_ardour/midi_time_axis.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2012-06-10 16:42:17 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2012-06-10 16:42:17 +0000
commit23350c195db2a8a777ca8d471174b44255c96ec4 (patch)
treeed17d2c8545b38fdc879e96ddb13a22c6986218f /gtk2_ardour/midi_time_axis.cc
parentdf6222b3b408ecf2aa673beb0fdff2fa309a81a1 (diff)
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
Diffstat (limited to 'gtk2_ardour/midi_time_axis.cc')
-rw-r--r--gtk2_ardour/midi_time_axis.cc25
1 files changed, 22 insertions, 3 deletions
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<MIDI::Name::Patch> 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);
+ }
+}