internally, ControllableDescriptors (used by MIDI binding maps) should use enums for automation types, rather than something custom

This commit is contained in:
Paul Davis 2018-05-04 08:24:07 -04:00
parent 1f9963cd56
commit 2e41652e61
4 changed files with 28 additions and 45 deletions

View file

@ -24,6 +24,7 @@
#include <stdint.h> #include <stdint.h>
#include "ardour/libardour_visibility.h" #include "ardour/libardour_visibility.h"
#include "ardour/types.h"
namespace ARDOUR { namespace ARDOUR {
@ -38,23 +39,9 @@ public:
SelectionCount, SelectionCount,
}; };
enum SubType {
Gain,
Trim,
Solo,
Mute,
Recenable,
PanDirection,
PanWidth,
PanElevation,
Balance,
SendGain,
PluginParameter
};
ControllableDescriptor () ControllableDescriptor ()
: _top_level_type (PresentationOrderRoute) : _top_level_type (PresentationOrderRoute)
, _subtype (Gain) , _subtype (GainAutomation)
, _banked (false) , _banked (false)
, _bank_offset (0) , _bank_offset (0)
{} {}
@ -68,7 +55,7 @@ public:
TopLevelType top_level_type() const { return _top_level_type; } TopLevelType top_level_type() const { return _top_level_type; }
const std::string& top_level_name() const { return _top_level_name; } 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 presentation_order() const;
uint32_t selection_id() const; uint32_t selection_id() const;
@ -79,7 +66,7 @@ public:
private: private:
TopLevelType _top_level_type; TopLevelType _top_level_type;
SubType _subtype; AutomationType _subtype;
std::string _top_level_name; std::string _top_level_name;
union { union {
uint32_t _presentation_order; uint32_t _presentation_order;

View file

@ -151,7 +151,10 @@ namespace ARDOUR {
PhaseAutomation, PhaseAutomation,
MonitoringAutomation, MonitoringAutomation,
BusSendLevel, BusSendLevel,
BusSendEnable BusSendEnable,
SendLevelAutomation, /* used only by a controllable descriptor
to refer to gain of a particular send
*/
}; };
enum AutoState { enum AutoState {

View file

@ -138,33 +138,30 @@ ControllableDescriptor::set (const std::string& str)
} }
if (path[1] == "gain") { if (path[1] == "gain") {
_subtype = Gain; _subtype = GainAutomation;
} else if (path[1] == "trim") { } else if (path[1] == "trim") {
_subtype = Trim; _subtype = TrimAutomation;
} else if (path[1] == "solo") { } else if (path[1] == "solo") {
_subtype = Solo; _subtype = SoloAutomation;
} else if (path[1] == "mute") { } else if (path[1] == "mute") {
_subtype = Mute; _subtype = MuteAutomation;
} else if (path[1] == "recenable") { } else if (path[1] == "recenable") {
_subtype = Recenable; _subtype = RecEnableAutomation;
} else if (path[1] == "balance") {
_subtype = Balance;
} else if (path[1] == "panwidth") { } else if (path[1] == "panwidth") {
_subtype = PanWidth; _subtype = PanWidthAutomation;
} else if (path[1] == "pandirection") { } else if (path[1] == "pandirection" || path[1] == "balance") {
_subtype = PanDirection; _subtype = PanAzimuthAutomation;
} else if (path[1] == "plugin") { } else if (path[1] == "plugin") {
if (path.size() == 3 && rest.size() == 3) { if (path.size() == 3 && rest.size() == 3) {
if (path[2] == "parameter") { if (path[2] == "parameter") {
_subtype = PluginParameter; _subtype = PluginAutomation;
_target.push_back (atoi (rest[1])); _target.push_back (atoi (rest[1]));
_target.push_back (atoi (rest[2])); _target.push_back (atoi (rest[2]));
} else { } else {
@ -177,7 +174,7 @@ ControllableDescriptor::set (const std::string& str)
if (path.size() == 3 && rest.size() == 2) { if (path.size() == 3 && rest.size() == 2) {
if (path[2] == "gain") { if (path[2] == "gain") {
_subtype = SendGain; _subtype = SendLevelAutomation;
_target.push_back (atoi (rest[1])); _target.push_back (atoi (rest[1]));
} else { } else {
return -1; return -1;

View file

@ -3784,43 +3784,39 @@ Session::controllable_by_descriptor (const ControllableDescriptor& desc)
r = boost::dynamic_pointer_cast<Route> (s); r = boost::dynamic_pointer_cast<Route> (s);
switch (desc.subtype()) { switch (desc.subtype()) {
case ControllableDescriptor::Gain: case GainAutomation:
c = s->gain_control (); c = s->gain_control ();
break; break;
case ControllableDescriptor::Trim: case TrimAutomation:
c = s->trim_control (); c = s->trim_control ();
break; break;
case ControllableDescriptor::Solo: case SoloAutomation:
c = s->solo_control(); c = s->solo_control();
break; break;
case ControllableDescriptor::Mute: case MuteAutomation:
c = s->mute_control(); c = s->mute_control();
break; break;
case ControllableDescriptor::Recenable: case RecEnableAutomation:
c = s->rec_enable_control (); c = s->rec_enable_control ();
break; break;
case ControllableDescriptor::PanDirection: case PanAzimuthAutomation:
c = s->pan_azimuth_control(); c = s->pan_azimuth_control();
break; break;
case ControllableDescriptor::PanWidth: case PanWidthAutomation:
c = s->pan_width_control(); c = s->pan_width_control();
break; break;
case ControllableDescriptor::PanElevation: case PanElevationAutomation:
c = s->pan_elevation_control(); c = s->pan_elevation_control();
break; break;
case ControllableDescriptor::Balance: case PluginAutomation:
/* XXX simple pan control */
break;
case ControllableDescriptor::PluginParameter:
{ {
uint32_t plugin = desc.target (0); uint32_t plugin = desc.target (0);
uint32_t parameter_index = desc.target (1); uint32_t parameter_index = desc.target (1);
@ -3848,7 +3844,7 @@ Session::controllable_by_descriptor (const ControllableDescriptor& desc)
break; break;
} }
case ControllableDescriptor::SendGain: { case SendLevelAutomation: {
uint32_t send = desc.target (0); uint32_t send = desc.target (0);
if (send > 0) { if (send > 0) {
--send; --send;