diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2012-04-12 21:02:43 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2012-04-12 21:02:43 +0000 |
commit | 939801a8d87a56f98ffdc9bb96f1c11e299f4edf (patch) | |
tree | abd5010e33426866d8cda99b5ac751e610edeeb1 /libs/surfaces/mackie/controls.cc | |
parent | b4235221abb9708424b3baa1068e1e70765aa989 (diff) |
MCP: start generalizing mapping between surface controls and ARDOUR::AutomationControl; simplify flip mode; more good stuff
git-svn-id: svn://localhost/ardour2/branches/3.0@11949 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/surfaces/mackie/controls.cc')
-rw-r--r-- | libs/surfaces/mackie/controls.cc | 58 |
1 files changed, 57 insertions, 1 deletions
diff --git a/libs/surfaces/mackie/controls.cc b/libs/surfaces/mackie/controls.cc index 9b546f00cf..f5df04be4a 100644 --- a/libs/surfaces/mackie/controls.cc +++ b/libs/surfaces/mackie/controls.cc @@ -20,11 +20,12 @@ #include <iomanip> #include <sstream> +#include "ardour/automation_control.h" + #include "controls.h" #include "types.h" #include "surface.h" #include "control_group.h" - #include "button.h" #include "led.h" #include "pot.h" @@ -35,6 +36,7 @@ using namespace Mackie; using namespace std; +using ARDOUR::AutomationControl; void Group::add (Control& control) { @@ -91,3 +93,57 @@ Jog::factory (Surface& surface, int id, const char* name, Group& group) return j; } +void +Control::set_normal_control (boost::shared_ptr<AutomationControl> ac) +{ + normal_ac = ac; +} + +void +Control::set_modified_control (boost::shared_ptr<AutomationControl> ac) +{ + modified_ac = ac; +} + +void +Control::set_value (float val, bool modified) +{ + if (modified && modified_ac) { + modified_ac->set_value (modified_ac->interface_to_internal (val)); + } else if (normal_ac) { + normal_ac->set_value (modified_ac->interface_to_internal (val)); + } +} + +float +Control::get_value (bool modified) +{ + if (modified && modified_ac) { + return modified_ac->internal_to_interface (modified_ac->get_value()); + } else if (normal_ac) { + return normal_ac->internal_to_interface (normal_ac->get_value()); + } + + return 0.0; +} + +void +Control::start_touch (double when, bool modified) +{ + if (modified && modified_ac) { + return modified_ac->start_touch (when); + } else if (normal_ac) { + return normal_ac->start_touch (when); + } +} + +void +Control::stop_touch (double when, bool mark, bool modified) +{ + if (modified && modified_ac) { + return modified_ac->stop_touch (when, mark); + } else if (normal_ac) { + return normal_ac->stop_touch (when, mark); + } +} + |