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 "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;

View file

@ -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 {

View file

@ -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;

View file

@ -3784,43 +3784,39 @@ Session::controllable_by_descriptor (const ControllableDescriptor& desc)
r = boost::dynamic_pointer_cast<Route> (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;