From 2e41652e617a9d9e938aca267035bf788d096753 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 4 May 2018 08:24:07 -0400 Subject: internally, ControllableDescriptors (used by MIDI binding maps) should use enums for automation types, rather than something custom --- libs/ardour/ardour/controllable_descriptor.h | 21 ++++----------------- libs/ardour/ardour/types.h | 5 ++++- libs/ardour/controllable_descriptor.cc | 23 ++++++++++------------- libs/ardour/session_state.cc | 24 ++++++++++-------------- 4 files changed, 28 insertions(+), 45 deletions(-) (limited to 'libs/ardour') diff --git a/libs/ardour/ardour/controllable_descriptor.h b/libs/ardour/ardour/controllable_descriptor.h index 9f160227dc..af762473a9 100644 --- a/libs/ardour/ardour/controllable_descriptor.h +++ b/libs/ardour/ardour/controllable_descriptor.h @@ -24,6 +24,7 @@ #include #include "ardour/libardour_visibility.h" +#include "ardour/types.h" namespace ARDOUR { @@ -38,23 +39,9 @@ public: SelectionCount, }; - enum SubType { - Gain, - Trim, - Solo, - Mute, - Recenable, - PanDirection, - PanWidth, - PanElevation, - Balance, - SendGain, - PluginParameter - }; - ControllableDescriptor () : _top_level_type (PresentationOrderRoute) - , _subtype (Gain) + , _subtype (GainAutomation) , _banked (false) , _bank_offset (0) {} @@ -68,7 +55,7 @@ public: TopLevelType top_level_type() const { return _top_level_type; } const std::string& top_level_name() const { return _top_level_name; } - SubType subtype() const { return _subtype; } + AutomationType subtype() const { return _subtype; } uint32_t presentation_order() const; uint32_t selection_id() const; @@ -79,7 +66,7 @@ public: private: TopLevelType _top_level_type; - SubType _subtype; + AutomationType _subtype; std::string _top_level_name; union { uint32_t _presentation_order; diff --git a/libs/ardour/ardour/types.h b/libs/ardour/ardour/types.h index 4bdab6b070..1d08c5bea3 100644 --- a/libs/ardour/ardour/types.h +++ b/libs/ardour/ardour/types.h @@ -151,7 +151,10 @@ namespace ARDOUR { PhaseAutomation, MonitoringAutomation, BusSendLevel, - BusSendEnable + BusSendEnable, + SendLevelAutomation, /* used only by a controllable descriptor + to refer to gain of a particular send + */ }; enum AutoState { diff --git a/libs/ardour/controllable_descriptor.cc b/libs/ardour/controllable_descriptor.cc index fff8b0050b..11947103c0 100644 --- a/libs/ardour/controllable_descriptor.cc +++ b/libs/ardour/controllable_descriptor.cc @@ -138,33 +138,30 @@ ControllableDescriptor::set (const std::string& str) } if (path[1] == "gain") { - _subtype = Gain; + _subtype = GainAutomation; } else if (path[1] == "trim") { - _subtype = Trim; + _subtype = TrimAutomation; } else if (path[1] == "solo") { - _subtype = Solo; + _subtype = SoloAutomation; } else if (path[1] == "mute") { - _subtype = Mute; + _subtype = MuteAutomation; } else if (path[1] == "recenable") { - _subtype = Recenable; - - } else if (path[1] == "balance") { - _subtype = Balance; + _subtype = RecEnableAutomation; } else if (path[1] == "panwidth") { - _subtype = PanWidth; + _subtype = PanWidthAutomation; - } else if (path[1] == "pandirection") { - _subtype = PanDirection; + } else if (path[1] == "pandirection" || path[1] == "balance") { + _subtype = PanAzimuthAutomation; } else if (path[1] == "plugin") { if (path.size() == 3 && rest.size() == 3) { if (path[2] == "parameter") { - _subtype = PluginParameter; + _subtype = PluginAutomation; _target.push_back (atoi (rest[1])); _target.push_back (atoi (rest[2])); } else { @@ -177,7 +174,7 @@ ControllableDescriptor::set (const std::string& str) if (path.size() == 3 && rest.size() == 2) { if (path[2] == "gain") { - _subtype = SendGain; + _subtype = SendLevelAutomation; _target.push_back (atoi (rest[1])); } else { return -1; diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index ebb2b99cc1..fcaa76e2ee 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -3784,43 +3784,39 @@ Session::controllable_by_descriptor (const ControllableDescriptor& desc) r = boost::dynamic_pointer_cast (s); switch (desc.subtype()) { - case ControllableDescriptor::Gain: + case GainAutomation: c = s->gain_control (); break; - case ControllableDescriptor::Trim: + case TrimAutomation: c = s->trim_control (); break; - case ControllableDescriptor::Solo: + case SoloAutomation: c = s->solo_control(); break; - case ControllableDescriptor::Mute: + case MuteAutomation: c = s->mute_control(); break; - case ControllableDescriptor::Recenable: + case RecEnableAutomation: c = s->rec_enable_control (); break; - case ControllableDescriptor::PanDirection: + case PanAzimuthAutomation: c = s->pan_azimuth_control(); break; - case ControllableDescriptor::PanWidth: + case PanWidthAutomation: c = s->pan_width_control(); break; - case ControllableDescriptor::PanElevation: + case PanElevationAutomation: c = s->pan_elevation_control(); break; - case ControllableDescriptor::Balance: - /* XXX simple pan control */ - break; - - case ControllableDescriptor::PluginParameter: + case PluginAutomation: { uint32_t plugin = desc.target (0); uint32_t parameter_index = desc.target (1); @@ -3848,7 +3844,7 @@ Session::controllable_by_descriptor (const ControllableDescriptor& desc) break; } - case ControllableDescriptor::SendGain: { + case SendLevelAutomation: { uint32_t send = desc.target (0); if (send > 0) { --send; -- cgit v1.2.3