enum ControlSrcType
{
- NONE,
+ NO_SOURCE,
BUTTON,
AXIS_POS,
AXIS_NEG
*/
struct ControlSource
{
- Device *dev;
- ControlSrcType type;
- unsigned index;
+ Device *dev = nullptr;
+ ControlSrcType type = NO_SOURCE;
+ unsigned index = 0;
- ControlSource();
+ ControlSource() = default;
ControlSource(Device &, ControlSrcType, unsigned);
std::string str() const;
};
protected:
ControlSource src;
- Device *capture_dev;
- BinaryControl *activator;
- float origin;
+ Device *capture_dev = nullptr;
+ BinaryControl *activator = nullptr;
+ float origin = 0.0f;
+ bool rising_edge = false;
+ bool falling_edge = false;
- Control();
+ Control() = default;
Control(const ControlSource &);
Control(Device &, ControlSrcType, unsigned);
public:
const ControlSource &get_source() const { return src; }
void set_activator(BinaryControl *);
BinaryControl *get_activator() const { return activator; }
+ bool has_rising_edge() const { return rising_edge; }
+ bool has_falling_edge() const { return falling_edge; }
+ void reset_edges();
protected:
virtual void on_press() = 0;
virtual void on_release() = 0;