2 Copyright (C) 2006,2007 John Anderson
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #include "ardour/automation_control.h"
24 #include "pbd/enumwriter.h"
29 #include "control_group.h"
39 using namespace ArdourSurface;
40 using namespace US2400;
42 using ARDOUR::AutomationControl;
44 void Group::add (Control& control)
46 _controls.push_back (&control);
49 Control::Control (int id, std::string name, Group & group)
57 /** @return true if the control is in use, or false otherwise.
58 Buttons are `in use' when they are held down.
59 Faders with touch support are `in use' when they are being touched.
60 Pots, or faders without touch support, are `in use' from the first move
61 event until a timeout after the last move event.
64 Control::in_use () const
70 Control::set_in_use (bool in_use)
76 Control::set_control (boost::shared_ptr<AutomationControl> ac)
82 Control::set_value (float val, PBD::Controllable::GroupControlDisposition group_override)
85 normal_ac->set_value (normal_ac->interface_to_internal (val), group_override);
95 return normal_ac->internal_to_interface (normal_ac->get_value());
99 Control::start_touch (double when)
102 return normal_ac->start_touch (when);
107 Control::stop_touch (double when)
110 return normal_ac->stop_touch (when);
114 ostream & operator << (ostream & os, const ArdourSurface::US2400::Control & control)
116 os << typeid (control).name();
118 os << "name: " << control.name();
120 os << "id: " << "0x" << setw(2) << setfill('0') << hex << control.id() << setfill(' ');
122 os << "group: " << control.group().name();