X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fsurfaces%2Fmackie%2Ftypes.h;h=87676ae0f6c8fbeba640bdd3f4dbfc37823daeec;hb=d0746b8378689268c0fc09e7c9155282ae6c7c38;hp=4fc52f66e4b498d1b58c568965d94e9c84440673;hpb=5ace191bff634c0b09eca5e69065afcb7d0cb183;p=ardour.git diff --git a/libs/surfaces/mackie/types.h b/libs/surfaces/mackie/types.h index 4fc52f66e4..87676ae0f6 100644 --- a/libs/surfaces/mackie/types.h +++ b/libs/surfaces/mackie/types.h @@ -20,12 +20,12 @@ #include -namespace Mackie -{ +namespace ArdourSurface { +namespace Mackie { -enum surface_type_t { - mcu, - ext, +enum surface_type_t { + mcu, + ext, }; /** @@ -36,22 +36,24 @@ class LedState { public: enum state_t { none, off, flashing, on }; - LedState() : _state( none ) {} - LedState( bool yn ): _state( yn ? on : off ) {} - LedState( state_t state ): _state( state ) {} + LedState() : _state (none) {} + LedState (bool yn): _state (yn ? on : off) {} + LedState (state_t state): _state (state) {} + + LedState& operator= (state_t s) { _state = s; return *this; } - bool operator == ( const LedState & other ) const + bool operator == (const LedState & other) const { return state() == other.state(); } - - bool operator != ( const LedState & other ) const + + bool operator != (const LedState & other) const { return state() != other.state(); } - + state_t state() const { return _state; } - + private: state_t _state; }; @@ -70,32 +72,32 @@ enum ButtonState { neither = -1, release = 0, press = 1 }; struct ControlState { ControlState(): pos(0.0), sign(0), delta(0.0), ticks(0), led_state(off), button_state(neither) {} - - ControlState( LedState ls ): pos(0.0), delta(0.0), led_state(ls), button_state(neither) {} - + + ControlState (LedState ls): pos(0.0), delta(0.0), led_state(ls), button_state(neither) {} + // Note that this sets both pos and delta to the flt value - ControlState( LedState ls, float flt ): pos(flt), delta(flt), ticks(0), led_state(ls), button_state(neither) {} - ControlState( float flt ): pos(flt), delta(flt), ticks(0), led_state(none), button_state(neither) {} - ControlState( float flt, unsigned int tcks ): pos(flt), delta(flt), ticks(tcks), led_state(none), button_state(neither) {} - ControlState( ButtonState bs ): pos(0.0), delta(0.0), ticks(0), led_state(none), button_state(bs) {} - + ControlState (LedState ls, float flt): pos(flt), delta(flt), ticks(0), led_state(ls), button_state(neither) {} + ControlState (float flt): pos(flt), delta(flt), ticks(0), led_state(none), button_state(neither) {} + ControlState (float flt, unsigned int tcks): pos(flt), delta(flt), ticks(tcks), led_state(none), button_state(neither) {} + ControlState (ButtonState bs): pos(0.0), delta(0.0), ticks(0), led_state(none), button_state(bs) {} + /// For faders. Between 0 and 1. float pos; - + /// For pots. Sign. Either -1 or 1; int sign; /// For pots. Signed value of total movement. Between 0 and 1 float delta; - + /// For pots. Unsigned number of ticks. Usually between 1 and 16. unsigned int ticks; - + LedState led_state; ButtonState button_state; }; -std::ostream & operator << ( std::ostream &, const ControlState & ); +std::ostream & operator << (std::ostream &, const ControlState &); class Control; class Fader; @@ -104,8 +106,8 @@ class Strip; class Group; class Pot; class Led; -class LedRing; +} } #endif