summaryrefslogtreecommitdiff
path: root/gtk2_ardour/midi_time_axis.cc
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2013-01-20 00:46:55 +0000
committerDavid Robillard <d@drobilla.net>2013-01-20 00:46:55 +0000
commit88de45b7ccc933ee46a13d4e4e21caf9e5fb379e (patch)
tree5e72e7caa7b88b8d29e8dad226c317fc8e31d3bb /gtk2_ardour/midi_time_axis.cc
parent448c156b4bac6204dd6b627b07b226f63f1301b4 (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_time_axis.cc')
-rw-r--r--gtk2_ardour/midi_time_axis.cc25
1 files changed, 20 insertions, 5 deletions
diff --git a/gtk2_ardour/midi_time_axis.cc b/gtk2_ardour/midi_time_axis.cc
index b9162cfe2b..9d96ca756f 100644
--- a/gtk2_ardour/midi_time_axis.cc
+++ b/gtk2_ardour/midi_time_axis.cc
@@ -232,8 +232,7 @@ MidiTimeAxisView::set_route (boost::shared_ptr<Route> rt)
}
if (gui_property (X_("midnam-custom-device-mode")).empty()) {
- boost::shared_ptr<MIDI::Name::MasterDeviceNames> device_names = get_device_names(
- gui_property (X_("midnam-model-name")));
+ boost::shared_ptr<MIDI::Name::MasterDeviceNames> device_names = get_device_names();
if (device_names) {
set_gui_property (X_("midnam-custom-device-mode"),
*device_names->custom_device_mode_names().begin());
@@ -760,10 +759,27 @@ MidiTimeAxisView::add_multi_channel_controller_item(Menu_Helpers::MenuList& ctl_
dynamic_cast<Label*> (ctl_items.back().get_child())->set_use_markup (true);
}
+boost::shared_ptr<MIDI::Name::CustomDeviceMode>
+MidiTimeAxisView::get_device_mode()
+{
+ using namespace MIDI::Name;
+
+ boost::shared_ptr<MasterDeviceNames> device_names = get_device_names();
+ if (!device_names) {
+ return boost::shared_ptr<MIDI::Name::CustomDeviceMode>();
+ }
+
+ return device_names->custom_device_mode_by_name(
+ gui_property (X_("midnam-custom-device-mode")));
+}
+
boost::shared_ptr<MIDI::Name::MasterDeviceNames>
-MidiTimeAxisView::get_device_names(const std::string& model)
+MidiTimeAxisView::get_device_names()
{
using namespace MIDI::Name;
+
+ const std::string model = gui_property (X_("midnam-model-name"));
+
boost::shared_ptr<MIDINameDocument> midnam = MidiPatchManager::instance()
.document_by_model(model);
if (midnam) {
@@ -807,8 +823,7 @@ MidiTimeAxisView::build_controller_menu ()
}
using namespace MIDI::Name;
- boost::shared_ptr<MasterDeviceNames> device_names = get_device_names(
- _midnam_model_selector.get_active_text());
+ boost::shared_ptr<MasterDeviceNames> device_names = get_device_names();
if (device_names && !device_names->controls().empty()) {
/* Controllers names available in midnam file, generate fancy menu */