track changes to config parameters for MMC device id's correctly (from roy vegard)
[ardour2.git] / libs / surfaces / tranzport / lights.cc
blobc0e8092f45290c48911a7929a09d407becca6528
1 /*
2 * Copyright (C) 2006 Paul Davis
3 * Copyright (C) 2007 Michael Taht
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 * */
21 #include <tranzport_control_protocol.h>
23 // Lights are buffered, and arguably these functions should be eliminated or inlined
25 void
26 TranzportControlProtocol::lights_on ()
28 lights_pending.set();
31 void
32 TranzportControlProtocol::lights_off ()
34 lights_pending.reset();
37 int
38 TranzportControlProtocol::light_on (LightID light)
40 lights_pending.set(light);
41 return 0;
44 int
45 TranzportControlProtocol::light_off (LightID light)
47 lights_pending.reset(light);
48 return 0;
51 void TranzportControlProtocol::lights_init()
53 lights_invalid.set();
54 lights_flash = lights_pending = lights_current.reset();
58 // Now that all this is bitsets, I don't see much
59 // need for these 4 to remain in the API
61 void TranzportControlProtocol::light_validate (LightID light)
63 lights_invalid.reset(light);
66 void TranzportControlProtocol::light_invalidate (LightID light)
68 lights_invalid.set(light);
71 void TranzportControlProtocol::lights_validate ()
73 lights_invalid.reset();
76 void TranzportControlProtocol::lights_invalidate ()
78 lights_invalid.set();
81 int
82 TranzportControlProtocol::light_set (LightID light, bool offon)
84 uint8_t cmd[8];
85 cmd[0] = 0x00; cmd[1] = 0x00; cmd[2] = light; cmd[3] = offon;
86 cmd[4] = 0x00; cmd[5] = 0x00; cmd[6] = 0x00; cmd[7] = 0x00;
88 if (write (cmd) == 0) {
89 lights_current[light] = offon;
90 lights_invalid.reset(light);
91 return 0;
92 } else {
93 return 1;