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.
25 #include "mackie_midi_builder.h"
27 #include "control_group.h"
38 using namespace Mackie;
41 void Group::add (Control& control)
43 _controls.push_back (&control);
46 Control::Control (int id, std::string name, Group & group)
54 /** @return true if the control is in use, or false otherwise.
55 Buttons are `in use' when they are held down.
56 Faders with touch support are `in use' when they are being touched.
57 Pots, or faders without touch support, are `in use' from the first move
58 event until a timeout after the last move event.
61 Control::in_use () const
67 Control::set_in_use (bool in_use)
72 ostream & Mackie::operator << (ostream & os, const Mackie::Control & control)
74 os << typeid (control).name();
76 os << "name: " << control.name();
78 os << "id: " << "0x" << setw(4) << setfill('0') << hex << control.id() << setfill(' ');
80 os << "type: " << "0x" << setw(2) << setfill('0') << hex << control.type() << setfill(' ');
82 os << "raw_id: " << "0x" << setw(2) << setfill('0') << hex << control.raw_id() << setfill(' ');
84 os << "group: " << control.group().name();
91 Pot::factory (Surface& surface, int id, const char* name, Group& group)
93 Pot* p = new Pot (id, name, group);
95 surface.controls.push_back (p);
101 Led::factory (Surface& surface, int id, const char* name, Group& group)
103 Led* l = new Led (id, name, group);
104 surface.leds[id] = l;
105 surface.controls.push_back (l);
111 Jog::factory (Surface& surface, int id, const char* name, Group& group)
113 Jog* j = new Jog (id, name, group);
114 surface.controls.push_back (j);
115 surface.controls_by_name["jog"] = j;