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.
18 #ifndef mackie_types_h
19 #define mackie_types_h
27 This started off as an enum, but it got really annoying
33 enum state_t { none, off, flashing, on };
34 LedState() : _state( none ) {}
35 LedState( bool yn ): _state( yn ? on : off ) {}
36 LedState( state_t state ): _state( state ) {}
38 bool operator == ( const LedState & other ) const
40 return state() == other.state();
43 bool operator != ( const LedState & other ) const
45 return state() != other.state();
48 state_t state() const { return _state; }
56 extern LedState flashing;
59 enum ButtonState { neither = -1, release = 0, press = 1 };
62 Contains the state for a control, with some convenience
67 ControlState(): pos(0.0), delta(0.0), button_state(neither) {}
69 ControlState( LedState ls ): pos(0.0), delta(0.0), led_state(ls), button_state(neither) {}
71 // Note that this sets both pos and delta to the flt value
72 ControlState( LedState ls, float flt ): pos(flt), delta(flt), ticks(0), led_state(ls), button_state(neither) {}
73 ControlState( float flt ): pos(flt), delta(flt), ticks(0), led_state(none), button_state(neither) {}
74 ControlState( float flt, int tcks ): pos(flt), delta(flt), ticks(tcks), led_state(none), button_state(neither) {}
75 ControlState( ButtonState bs ): pos(0.0), delta(0.0), ticks(0), led_state(none), button_state(bs) {}
81 ButtonState button_state;