summaryrefslogtreecommitdiff
path: root/libs/ardour
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2018-06-21 13:05:37 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2018-06-21 13:05:58 -0400
commit8a18929d57ef82b1233278668a9efe78fe1c17f0 (patch)
tree41dd4f8bb487f6a570987c04c7601dae9ca3edf9 /libs/ardour
parent637e70749cf32331df4d09b56f3c819f42f8097e (diff)
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.
Diffstat (limited to 'libs/ardour')
-rw-r--r--libs/ardour/ardour/controllable_descriptor.h82
-rw-r--r--libs/ardour/ardour/session.h2
-rw-r--r--libs/ardour/ardour/types.h20
-rw-r--r--libs/ardour/controllable_descriptor.cc298
-rw-r--r--libs/ardour/session_state.cc187
-rw-r--r--libs/ardour/wscript1
6 files changed, 0 insertions, 590 deletions
diff --git a/libs/ardour/ardour/controllable_descriptor.h b/libs/ardour/ardour/controllable_descriptor.h
deleted file mode 100644
index af762473a9..0000000000
--- a/libs/ardour/ardour/controllable_descriptor.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- Copyright (C) 2009 Paul Davis
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#ifndef __libardour_controllable_descriptor_h__
-#define __libardour_controllable_descriptor_h__
-
-#include <vector>
-#include <string>
-#include <stdint.h>
-
-#include "ardour/libardour_visibility.h"
-#include "ardour/types.h"
-
-namespace ARDOUR {
-
-class LIBARDOUR_API ControllableDescriptor {
-public:
- enum TopLevelType {
- PresentationOrderRoute,
- PresentationOrderTrack,
- PresentationOrderBus,
- PresentationOrderVCA,
- NamedRoute,
- SelectionCount,
- };
-
- ControllableDescriptor ()
- : _top_level_type (PresentationOrderRoute)
- , _subtype (GainAutomation)
- , _banked (false)
- , _bank_offset (0)
- {}
-
- int set (const std::string&);
-
- /* it is only valid to call top_level_name() if top_level_type() returns
- NamedRoute
- */
-
- TopLevelType top_level_type() const { return _top_level_type; }
- const std::string& top_level_name() const { return _top_level_name; }
-
- AutomationType subtype() const { return _subtype; }
-
- uint32_t presentation_order() const;
- uint32_t selection_id() const;
- uint32_t target (uint32_t n) const;
- bool banked() const { return _banked; }
-
- void set_bank_offset (uint32_t o) { _bank_offset = o; }
-
-private:
- TopLevelType _top_level_type;
- AutomationType _subtype;
- std::string _top_level_name;
- union {
- uint32_t _presentation_order;
- uint32_t _selection_id;
- };
- std::vector<uint32_t> _target;
- uint32_t _banked;
- uint32_t _bank_offset;
-};
-
-}
-
-#endif /* __libardour_controllable_descriptor_h__ */
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index 4cf725ae2f..835e6668bc 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -116,7 +116,6 @@ class BufferSet;
class Bundle;
class Butler;
class Click;
-class ControllableDescriptor;
class CoreSelection;
class ExportHandler;
class ExportStatus;
@@ -1082,7 +1081,6 @@ public:
boost::shared_ptr<PBD::Controllable> controllable_by_id (const PBD::ID&);
boost::shared_ptr<AutomationControl> automation_control_by_id (const PBD::ID&);
- boost::shared_ptr<PBD::Controllable> controllable_by_descriptor (const ARDOUR::ControllableDescriptor&);
void add_controllable (boost::shared_ptr<PBD::Controllable>);
void remove_controllable (PBD::Controllable*);
diff --git a/libs/ardour/ardour/types.h b/libs/ardour/ardour/types.h
index ed6ba96617..a3af7e2c3d 100644
--- a/libs/ardour/ardour/types.h
+++ b/libs/ardour/ardour/types.h
@@ -158,26 +158,6 @@ namespace ARDOUR {
SendLevelAutomation,
SendEnableAutomation,
SendAzimuthAutomation,
-
- /* these describe "well known" controls of a Stripable that are
- covered by the types above. They should be used only as part
- of ControllableDescriptor
- */
-
- EQEnableAutomation,
- EQGainAutomation,
- EQFreqAutomation,
- EQQAutomation,
- EQShapeAutomation,
- FilterFreqAutomation,
- FilterSlopeAutomation,
- FilterEnableAutomation,
- CompressorEnableAutomation,
- CompressorThresholdAutomation,
- CompressorSpeedAutomation,
- CompressorModeAutomation,
- CompressorMakeupAutomation,
- /* Redux not included because it is read-only */
};
enum AutoState {
diff --git a/libs/ardour/controllable_descriptor.cc b/libs/ardour/controllable_descriptor.cc
deleted file mode 100644
index b55b0b3c4c..0000000000
--- a/libs/ardour/controllable_descriptor.cc
+++ /dev/null
@@ -1,298 +0,0 @@
-/*
- Copyright (C) 2009 Paul Davis
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#ifdef COMPILER_MSVC
-#include <io.h> // Microsoft's nearest equivalent to <unistd.h>
-#include <ardourext/misc.h>
-#else
-#include <regex.h>
-#endif
-
-#include "pbd/strsplit.h"
-#include "pbd/convert.h"
-
-#include "ardour/controllable_descriptor.h"
-
-using namespace std;
-using namespace PBD;
-using namespace ARDOUR;
-
-int
-ControllableDescriptor::set (const std::string& str)
-{
- string::size_type first_space = str.find_first_of (" ");
-
- if (first_space == string::npos) {
- return -1;
- }
-
- string front = str.substr (0, first_space);
- string back = str.substr (first_space);
-
- vector<string> path;
- split (front, path, '/');
-
- if (path.size() < 2) {
- return -1;
- }
-
- vector<string> rest;
- split (back, rest, ' ');
-
- if (rest.size() < 1) {
- return -1;
- }
-
- bool stripable = false;
- regex_t compiled_pattern;
- const char * const pattern = "^[BS]?[0-9]+";
-
- if (path[0] == "route" || path[0] == "rid") {
-
- /* this is not going to fail */
- regcomp (&compiled_pattern, pattern, REG_EXTENDED|REG_NOSUB);
- bool matched = (regexec (&compiled_pattern, rest[0].c_str(), 0, 0, 0) == 0);
- regfree (&compiled_pattern);
-
- if (matched) {
- _top_level_type = PresentationOrderRoute;
- stripable = true;
- } else {
- _top_level_type = NamedRoute;
- _top_level_name = rest[0];
- }
-
- } else if (path[0] == "vca") {
- _top_level_type = PresentationOrderVCA;
- stripable = true;
- } else if (path[0] == "bus") {
- /* digits, or B<digits> or S<digits> will be used as for route;
- anything else will be treated as a track name.
- */
-
- /* this is not going to fail */
-
- regcomp (&compiled_pattern, pattern, REG_EXTENDED|REG_NOSUB);
- bool matched = (regexec (&compiled_pattern, rest[0].c_str(), 0, 0, 0) == 0);
- regfree (&compiled_pattern);
-
- if (matched) {
- _top_level_type = PresentationOrderBus;
- stripable = true;
- } else {
- _top_level_type = NamedRoute;
- _top_level_name = rest[0];
- }
-
- } else if (path[0] == "track") {
-
- /* digits, or B<digits> or S<digits> will be used as for route;
- anything else will be treated as a track name.
- */
-
- /* this is not going to fail */
- regcomp (&compiled_pattern, pattern, REG_EXTENDED|REG_NOSUB);
- bool matched = (regexec (&compiled_pattern, rest[0].c_str(), 0, 0, 0) == 0);
- regfree (&compiled_pattern);
-
- if (matched) {
- _top_level_type = PresentationOrderTrack;
- stripable = true;
- } else {
- _top_level_type = NamedRoute;
- _top_level_name = rest[0];
- }
- }
-
- if (stripable) {
- if (rest[0][0] == 'B') {
- _banked = true;
- _presentation_order = atoi (rest[0].substr (1));
- } else if (rest[0][0] == 'S') {
- _top_level_type = SelectionCount;
- _banked = true;
- _selection_id = atoi (rest[0].substr (1));
- } else if (isdigit (rest[0][0])) {
- _banked = false;
- _presentation_order = atoi (rest[0]);
- } else {
- return -1;
- }
-
- _presentation_order -= 1; /* order is zero-based, but maps use 1-based */
- }
-
- if (path[1] == "gain") {
- _subtype = GainAutomation;
-
- } else if (path[1] == "trim") {
- _subtype = TrimAutomation;
-
- } else if (path[1] == "solo") {
- _subtype = SoloAutomation;
-
- } else if (path[1] == "mute") {
- _subtype = MuteAutomation;
-
- } else if (path[1] == "recenable") {
- _subtype = RecEnableAutomation;
-
- } else if (path[1] == "panwidth") {
- _subtype = PanWidthAutomation;
-
- } 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 = PluginAutomation;
- _target.push_back (atoi (rest[1]));
- _target.push_back (atoi (rest[2]));
- } else {
- return -1;
- }
- } else {
- return -1;
- }
- } else if (path[1] == "send") {
-
- if (path.size() == 3 && rest.size() == 2) {
- if (path[2] == "gain") {
- _subtype = SendLevelAutomation;
- _target.push_back (atoi (rest[1]));
-
- } else if (path[2] == "direction") {
- _subtype = SendAzimuthAutomation;
- _target.push_back (atoi (rest[1]));
- } else if (path[2] == "enable") {
- _subtype = SendEnableAutomation;
- _target.push_back (atoi (rest[1]));
- } else {
- return -1;
-
- }
- } else {
- return -1;
- }
- } else if (path[1] == "eq") {
-
- /* /route/eq/gain/<band> */
-
- if (path.size() != 3) {
- return -1;
- }
-
- _target.push_back (atoi (path[3])); /* band number */
-
- if (path[2] == "enable") {
- _subtype = EQEnableAutomation;
- } else if (path[2] == "gain") {
- _subtype = EQGainAutomation;
- } else if (path[2] == "freq") {
- _subtype = EQFreqAutomation;
- } else if (path[2] == "q") {
- _subtype = EQQAutomation;
- } else if (path[2] == "shape") {
- _subtype = EQShapeAutomation;
- } else {
- return -1;
- }
-
- /* get desired band number */
- _target.push_back (atoi (rest[1]));
-
- } else if (path[1] == "filter") {
-
- /* /route/filter/hi/freq */
-
- if (path.size() != 4) {
- return -1;
- }
-
- if (path[2] == "hi") {
- _target.push_back (1); /* high pass filter */
- } else {
- _target.push_back (0); /* low pass filter */
- }
-
- if (path[3] == "enable") {
- _subtype = FilterFreqAutomation;
- } else if (path[3] == "freq") {
- _subtype = FilterFreqAutomation;
- } else if (path[3] == "slope") {
- _subtype = FilterSlopeAutomation;
- } else {
- return -1;
- }
-
- _target.push_back (atoi (rest[1]));
-
- } else if (path[1] == "compressor") {
-
- if (path.size() != 3) {
- return -1;
- }
-
- if (path[2] == "enable") {
- _subtype = CompressorEnableAutomation;
- } else if (path[2] == "threshold") {
- _subtype = CompressorThresholdAutomation;
- } else if (path[2] == "mode") {
- _subtype = CompressorModeAutomation;
- } else if (path[2] == "speed") {
- _subtype = CompressorSpeedAutomation;
- } else if (path[2] == "makeup") {
- _subtype = CompressorMakeupAutomation;
- } else {
- return -1;
- }
- }
-
- return 0;
-}
-
-uint32_t
-ControllableDescriptor::presentation_order () const
-{
- if (banked()) {
- return _presentation_order + _bank_offset;
- }
-
- return _presentation_order;
-}
-
-uint32_t
-ControllableDescriptor::selection_id () const
-{
- if (banked()) {
- return _selection_id + _bank_offset;
- }
-
- return _selection_id;
-}
-
-uint32_t
-ControllableDescriptor::target (uint32_t n) const
-{
- if (n < _target.size()) {
- return _target[n];
- }
-
- return 0;
-}
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<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)
{
diff --git a/libs/ardour/wscript b/libs/ardour/wscript
index 5a5c99f22c..ec36068720 100644
--- a/libs/ardour/wscript
+++ b/libs/ardour/wscript
@@ -56,7 +56,6 @@ libardour_sources = [
'chan_count.cc',
'chan_mapping.cc',
'config_text.cc',
- 'controllable_descriptor.cc',
'control_group.cc',
'control_protocol_manager.cc',
'cycle_timer.cc',