- boost::shared_ptr<Controllable> c;
- boost::shared_ptr<Stripable> s;
- boost::shared_ptr<Route> r;
-
- switch (desc.top_level_type()) {
- case ControllableDescriptor::NamedRoute:
- {
- std::string str = desc.top_level_name();
-
- if (str == "Master" || str == "master") {
- s = _master_out;
- } else if (str == "control" || str == "listen" || str == "monitor" || str == "Monitor") {
- s = _monitor_out;
- } else if (str == "auditioner") {
- s = auditioner;
- } else {
- s = route_by_name (desc.top_level_name());
- }
-
- break;
- }
-
- case ControllableDescriptor::PresentationOrderRoute:
- s = get_remote_nth_stripable (desc.presentation_order(), PresentationInfo::Route);
- break;
-
- case ControllableDescriptor::PresentationOrderTrack:
- s = get_remote_nth_stripable (desc.presentation_order(), PresentationInfo::Track);
- break;
-
- case ControllableDescriptor::PresentationOrderBus:
- s = get_remote_nth_stripable (desc.presentation_order(), PresentationInfo::Bus);
- break;
-
- case ControllableDescriptor::PresentationOrderVCA:
- s = get_remote_nth_stripable (desc.presentation_order(), PresentationInfo::VCA);
- break;
-
- case ControllableDescriptor::SelectionCount:
- s = route_by_selected_count (desc.selection_id());
- break;
- }
-
- if (!s) {
- return c;
- }
-
- r = boost::dynamic_pointer_cast<Route> (s);
-
- switch (desc.subtype()) {
- case ControllableDescriptor::Gain:
- c = s->gain_control ();
- break;
-
- case ControllableDescriptor::Trim:
- c = s->trim_control ();
- break;
-
- case ControllableDescriptor::Solo:
- c = s->solo_control();
- break;
-
- case ControllableDescriptor::Mute:
- c = s->mute_control();
- break;
-
- case ControllableDescriptor::Recenable:
- c = s->rec_enable_control ();
- break;
-
- case ControllableDescriptor::PanDirection:
- c = s->pan_azimuth_control();
- break;
-
- case ControllableDescriptor::PanWidth:
- c = s->pan_width_control();
- break;
-
- case ControllableDescriptor::PanElevation:
- c = s->pan_elevation_control();
- break;
-
- case ControllableDescriptor::Balance:
- /* XXX simple pan control */
- break;
-
- case ControllableDescriptor::PluginParameter:
- {
- uint32_t plugin = desc.target (0);
- uint32_t parameter_index = desc.target (1);
-
- /* revert to zero based counting */
-
- if (plugin > 0) {
- --plugin;
- }
-
- if (parameter_index > 0) {
- --parameter_index;
- }
-
- if (!r) {
- return c;
- }
-
- boost::shared_ptr<Processor> p = r->nth_plugin (plugin);
-
- if (p) {
- c = boost::dynamic_pointer_cast<ARDOUR::AutomationControl>(
- p->control(Evoral::Parameter(PluginAutomation, 0, parameter_index)));
- }
- break;
- }
-
- case ControllableDescriptor::SendGain: {
- uint32_t send = desc.target (0);
- if (send > 0) {
- --send;
- }
- if (!r) {
- return c;
- }
- c = r->send_level_controllable (send);
- break;
- }
-
- default:
- /* relax and return a null pointer */
- break;
- }
-
- return c;