19 #ifndef _ardour_surfaces_m2pad_h_
20 #define _ardour_surfaces_m2pad_h_
37 PBD::Signal2<void, float, bool>
event;
40 virtual uint16_t
value ()
const {
return 0; }
41 virtual float pressure ()
const {
return 0.f; }
47 virtual void color (uint8_t& r, uint8_t& g, uint8_t& b)
const {
63 for (
int i = 0; i < 4; ++i) {
73 void color (uint8_t& r, uint8_t& g, uint8_t& b)
const
75 r = ((
_rgba >> 24) & 0xff) >> 1;
76 g = ((
_rgba >> 16) & 0xff) >> 1;
77 b = ((
_rgba >> 8) & 0xff) >> 1;
83 static const uint16_t high = 159;
84 static const float low = 159 / 4095.f;
85 static const float mindelta = 32.f / 4096.f;
101 const float p = v / 4095.f;
116 bool above_thresh =
true;
118 for (
int i = 0; i < 4; ++i) {
119 if (
hist[i] < high) {
120 above_thresh =
false;
123 max = std::max (max,
hist[i]);
virtual void color(uint8_t &r, uint8_t &g, uint8_t &b) const
PBD::Signal1< void, float > changed
PBD::Signal2< void, float, bool > event
virtual float pressure() const
virtual void set_color(uint32_t rgba)
virtual ~M2PadInterface()
PBD::Signal0< void > released
virtual void set_value(uint16_t v)
PBD::Signal1< void, float > pressed
PBD::Signal1< void, float > aftertouch
virtual uint16_t value() const
void set_value(uint16_t v)
void set_color(uint32_t rgba)
void color(uint8_t &r, uint8_t &g, uint8_t &b) const