Ardour  8.7-14-g57a6773833
surfaces/us2400/types.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Ben Loftis <ben@harrisonconsoles.com>
3  *
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.
8  *
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.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 #ifndef mackie_types_h
19 #define mackie_types_h
20 
21 #include <iostream>
22 
23 namespace ArdourSurface {
24 namespace US2400 {
25 
31 };
32 
37 class LedState
38 {
39 public:
40  enum state_t { none, off, flashing, on };
41  LedState() : _state (none) {}
42  LedState (bool yn): _state (yn ? on : off) {}
44 
45  LedState& operator= (state_t s) { _state = s; return *this; }
46 
47  bool operator == (const LedState & other) const
48  {
49  return state() == other.state();
50  }
51 
52  bool operator != (const LedState & other) const
53  {
54  return state() != other.state();
55  }
56 
57  state_t state() const { return _state; }
58 
59 private:
61 };
62 
63 extern LedState on;
64 extern LedState off;
65 extern LedState flashing;
66 extern LedState none;
67 
68 enum ButtonState { neither = -1, release = 0, press = 1 };
69 
75 {
77 
79 
80  // Note that this sets both pos and delta to the flt value
81  ControlState (LedState ls, float flt): pos(flt), delta(flt), ticks(0), led_state(ls), button_state(neither) {}
82  ControlState (float flt): pos(flt), delta(flt), ticks(0), led_state(none), button_state(neither) {}
83  ControlState (float flt, unsigned int tcks): pos(flt), delta(flt), ticks(tcks), led_state(none), button_state(neither) {}
85 
87  float pos;
88 
90  int sign;
91 
93  float delta;
94 
96  unsigned int ticks;
97 
100 };
101 
102 std::ostream & operator << (std::ostream &, const ControlState &);
103 
104 class Control;
105 class Fader;
106 class Button;
107 class Strip;
108 class Group;
109 class Pot;
110 class Led;
111 
112 }
113 }
114 
115 #endif
bool operator!=(const LedState &other) const
bool operator==(const LedState &other) const
std::ostream & operator<<(std::ostream &, const SurfacePort &port)
DebugBits US2400
float pos
For faders. Between 0 and 1.
int sign
For pots. Sign. Either -1 or 1;.
unsigned int ticks
For pots. Unsigned number of ticks. Usually between 1 and 16.
ControlState(float flt, unsigned int tcks)
float delta
For pots. Signed value of total movement. Between 0 and 1.