From 8a18929d57ef82b1233278668a9efe78fe1c17f0 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 21 Jun 2018 13:05:37 -0400 Subject: remove Session::controllable_by_descriptor() and move code into GenericMIDI code (the only user). This also removes enums introduced to describe well-known parameters for Mixbus. Lookup now involves string parsing every time, but this is not likely to be a notable cost. --- libs/ardour/session_state.cc | 187 ------------------------------------------- 1 file changed, 187 deletions(-) (limited to 'libs/ardour/session_state.cc') diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index 346a359229..c278454843 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -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 (controllable_by_id (id)); } -boost::shared_ptr -Session::controllable_by_descriptor (const ControllableDescriptor& desc) -{ - boost::shared_ptr c; - boost::shared_ptr s; - boost::shared_ptr 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 (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 p = r->nth_plugin (plugin); - - if (p) { - c = boost::dynamic_pointer_cast( - 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) { -- cgit v1.2.3