remove Session::controllable_by_descriptor() and move code into GenericMIDI code...
[ardour.git] / libs / ardour / session_state.cc
index 346a3592291c39f93ec90700d47447614ffad8b9..c278454843ca818e262bb1b450c82ada27a5d1a3 100644 (file)
@@ -85,7 +85,6 @@
 #include "ardour/automation_control.h"
 #include "ardour/boost_debug.h"
 #include "ardour/butler.h"
-#include "ardour/controllable_descriptor.h"
 #include "ardour/control_protocol_manager.h"
 #include "ardour/directory_names.h"
 #include "ardour/disk_reader.h"
@@ -3731,192 +3730,6 @@ Session::automation_control_by_id (const PBD::ID& id)
        return boost::dynamic_pointer_cast<AutomationControl> (controllable_by_id (id));
 }
 
-boost::shared_ptr<Controllable>
-Session::controllable_by_descriptor (const ControllableDescriptor& desc)
-{
-       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 GainAutomation:
-               c = s->gain_control ();
-               break;
-
-       case TrimAutomation:
-               c = s->trim_control ();
-               break;
-
-       case SoloAutomation:
-               c = s->solo_control();
-               break;
-
-       case MuteAutomation:
-               c = s->mute_control();
-               break;
-
-       case RecEnableAutomation:
-               c = s->rec_enable_control ();
-               break;
-
-       case PanAzimuthAutomation:
-               c = s->pan_azimuth_control();
-               break;
-
-       case PanWidthAutomation:
-               c = s->pan_width_control();
-               break;
-
-       case PanElevationAutomation:
-               c = s->pan_elevation_control();
-               break;
-
-       case EQEnableAutomation:
-               c = s->eq_enable_controllable();
-               break;
-
-       case EQGainAutomation:
-               c = s->eq_gain_controllable(desc.target (0));
-               break;
-
-       case EQFreqAutomation:
-               c = s->eq_freq_controllable(desc.target(0));
-               break;
-
-       case EQQAutomation:
-               c = s->eq_q_controllable(desc.target(0));
-               break;
-
-       case EQShapeAutomation:
-               c = s->eq_shape_controllable(desc.target(0));
-               break;
-
-       case FilterFreqAutomation:
-               c = s->filter_freq_controllable(desc.target(0));
-               break;
-
-       case FilterSlopeAutomation:
-               c = s->filter_slope_controllable(desc.target(0));
-               break;
-
-       case FilterEnableAutomation:
-               c = s->filter_enable_controllable(desc.target(0));
-               break;
-
-       case CompressorEnableAutomation:
-               c = s->comp_enable_controllable();
-               break;
-
-       case CompressorThresholdAutomation:
-               c = s->comp_threshold_controllable();
-               break;
-
-       case CompressorSpeedAutomation:
-               c = s->comp_speed_controllable();
-               break;
-
-       case CompressorModeAutomation:
-               c = s->comp_mode_controllable();
-               break;
-
-       case CompressorMakeupAutomation:
-               c = s->comp_makeup_controllable();
-               break;
-
-       case PluginAutomation:
-       {
-               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 SendLevelAutomation: {
-               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;
-}
-
 void
 Session::add_instant_xml (XMLNode& node, bool write_to_config)
 {