summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2013-01-16 08:24:31 +0000
committerDavid Robillard <d@drobilla.net>2013-01-16 08:24:31 +0000
commite092fe33afc5cfd566e156f0d565cb1d0c1194f2 (patch)
tree167ab7737a1d946adc8a1de722dd68b86b9c4d4d /gtk2_ardour
parent65da5a7cc2c68475019b457f1ea3e60d5b37ceb4 (diff)
Preliminary support for named MIDI controllers via midname files.
Add midnam file for Moog Minitaur controller names. git-svn-id: svn://localhost/ardour2/branches/3.0@13852 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/midi_time_axis.cc35
1 files changed, 35 insertions, 0 deletions
diff --git a/gtk2_ardour/midi_time_axis.cc b/gtk2_ardour/midi_time_axis.cc
index 87d453c1d7..9db4a18ef4 100644
--- a/gtk2_ardour/midi_time_axis.cc
+++ b/gtk2_ardour/midi_time_axis.cc
@@ -626,6 +626,41 @@ MidiTimeAxisView::build_controller_menu ()
}
}
+ using namespace MIDI::Name;
+ const string& model = _midnam_model_selector.get_active_text();
+ boost::shared_ptr<MIDINameDocument> midnam = MidiPatchManager::instance()
+ .document_by_model(model);
+ boost::shared_ptr<MasterDeviceNames> device_names;
+ if (midnam && !midnam->master_device_names_by_model().empty()) {
+ device_names = boost::shared_ptr<MasterDeviceNames>(
+ midnam->master_device_names_by_model().begin()->second);
+ }
+
+ if (device_names && !device_names->controls().empty()) {
+ /* Controllers names available from the midnam file, generate a custom controller menu */
+ for (MasterDeviceNames::ControlNameLists::const_iterator l = device_names->controls().begin();
+ l != device_names->controls().end(); ++l) {
+ boost::shared_ptr<ControlNameList> name_list = *l;
+
+ int chn = 0; // TODO
+ Menu* group_menu = manage(new Menu());
+ MenuList& group_items(group_menu->items());
+
+ for (ControlNameList::Controls::const_iterator c = (*l)->controls().begin();
+ c != (*l)->controls().end(); ++c) {
+ Evoral::Parameter fully_qualified_param(MidiCCAutomation, chn, atoi((*c)->number().c_str()));
+ group_items.push_back(
+ CheckMenuElem(string_compose("<b>%1</b>: %2 [%3]",
+ (*c)->number(), (*c)->name(), int(chn)),
+ sigc::bind(sigc::mem_fun(*this, &RouteTimeAxisView::toggle_automation_track),
+ fully_qualified_param)));
+ dynamic_cast<Label*> (group_items.back().get_child())->set_use_markup (true);
+ }
+ items.push_back(MenuElem(name_list->name(), *group_menu));
+ }
+ return;
+ }
+
/* loop over all 127 MIDI controllers, in groups of 16; except don't offer
bank select controllers, as they are handled by the `patch' code */