From e092fe33afc5cfd566e156f0d565cb1d0c1194f2 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 16 Jan 2013 08:24:31 +0000 Subject: 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 --- gtk2_ardour/midi_time_axis.cc | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'gtk2_ardour') 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 midnam = MidiPatchManager::instance() + .document_by_model(model); + boost::shared_ptr device_names; + if (midnam && !midnam->master_device_names_by_model().empty()) { + device_names = boost::shared_ptr( + 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 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("%1: %2 [%3]", + (*c)->number(), (*c)->name(), int(chn)), + sigc::bind(sigc::mem_fun(*this, &RouteTimeAxisView::toggle_automation_track), + fully_qualified_param))); + dynamic_cast (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 */ -- cgit v1.2.3