diff options
author | David Robillard <d@drobilla.net> | 2013-01-20 00:46:55 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2013-01-20 00:46:55 +0000 |
commit | 88de45b7ccc933ee46a13d4e4e21caf9e5fb379e (patch) | |
tree | 5e72e7caa7b88b8d29e8dad226c317fc8e31d3bb /gtk2_ardour/midi_region_view.cc | |
parent | 448c156b4bac6204dd6b627b07b226f63f1301b4 (diff) |
Support note names from midnam files (tested with the DM5).
Do this via a simple MasterDeviceNames::note_name() function. The same really
needs to be done for program names, this stuff is absolutely brutal to use.
Store note names in a vector indexed by number instead of a list with string
"numbers" for reasonable lookup time.
Make some references const that should be.
git-svn-id: svn://localhost/ardour2/branches/3.0@13908 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/midi_region_view.cc')
-rw-r--r-- | gtk2_ardour/midi_region_view.cc | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc index bfc0489d0f..6931e5172b 100644 --- a/gtk2_ardour/midi_region_view.cc +++ b/gtk2_ardour/midi_region_view.cc @@ -1846,7 +1846,7 @@ MidiRegionView::patch_change_to_patch_key (MidiModel::PatchChangePtr p) } void -MidiRegionView::get_patch_key_at (double time, uint8_t channel, MIDI::Name::PatchPrimaryKey& key) +MidiRegionView::get_patch_key_at (double time, uint8_t channel, MIDI::Name::PatchPrimaryKey& key) const { MidiModel::PatchChanges::iterator i = _model->patch_change_lower_bound (time); while (i != _model->patch_changes().end() && (*i)->channel() != channel) { @@ -3808,14 +3808,32 @@ MidiRegionView::delete_sysex (CanvasSysEx* sysex) void MidiRegionView::show_verbose_cursor (boost::shared_ptr<NoteType> n) const { - char buf[24]; - snprintf (buf, sizeof (buf), "%s (%d) Chn %d\nVel %d", - Evoral::midi_note_name (n->note()).c_str(), + using namespace MIDI::Name; + + std::string name; + + MidiTimeAxisView* const mtv = dynamic_cast<MidiTimeAxisView*>(&trackview); + if (mtv) { + boost::shared_ptr<MasterDeviceNames> device_names(mtv->get_device_names()); + if (device_names) { + MIDI::Name::PatchPrimaryKey patch_key; + get_patch_key_at(n->time(), n->channel(), patch_key); + name = device_names->note_name(mtv->gui_property(X_("midnam-custom-device-mode")), + n->channel(), + patch_key.bank_number, + patch_key.program_number, + n->note()); + } + } + + char buf[128]; + snprintf (buf, sizeof (buf), "%d %s\nCh %d Vel %d", (int) n->note (), + name.empty() ? Evoral::midi_note_name (n->note()).c_str() : name.c_str(), (int) n->channel() + 1, (int) n->velocity()); - show_verbose_cursor (buf, 10, 20); + show_verbose_cursor(buf, 10, 20); } void |