summaryrefslogtreecommitdiff
path: root/libs/surfaces/faderport8/fp8_button.h
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2017-07-19 01:52:14 +0200
committerRobin Gareus <robin@gareus.org>2017-07-19 01:52:14 +0200
commit601604972c680ff8e04c991aa2c73cd4de689a1f (patch)
treec0852bfe8454d2b2ded26398281d789ef8d7f442 /libs/surfaces/faderport8/fp8_button.h
parent9a0a2a29b53a7d8b74d64039a3a594e54262ef29 (diff)
FP8: Fix Mixbus solo-state and indicate implicit solo (blink)
Diffstat (limited to 'libs/surfaces/faderport8/fp8_button.h')
-rw-r--r--libs/surfaces/faderport8/fp8_button.h26
1 files changed, 17 insertions, 9 deletions
diff --git a/libs/surfaces/faderport8/fp8_button.h b/libs/surfaces/faderport8/fp8_button.h
index cddf7f471f..4b27714cd1 100644
--- a/libs/surfaces/faderport8/fp8_button.h
+++ b/libs/surfaces/faderport8/fp8_button.h
@@ -106,20 +106,22 @@ public:
return true;
}
- void ignore_release () {
+ virtual void ignore_release () {
if (_pressed) {
_ignore_release = true;
}
}
+ bool blinking () const { return _blinking; }
+
void set_blinking (bool yes) {
if (yes && !_blinking) {
_blinking = true;
_base.BlinkIt.connect_same_thread (_blink_connection, boost::bind (&FP8ButtonBase::blink, this, _1));
} else if (!yes && _blinking) {
_blink_connection.disconnect ();
- blink (true);
_blinking = false;
+ blink (true);
}
}
@@ -360,14 +362,12 @@ private:
// short press: activate in press, deactivate on release,
// long press + hold, activate on press, de-activate directly on release
// e.g. mute/solo press + hold => changed()
-class FP8MomentaryButton : public FP8ButtonInterface
+class FP8MomentaryButton : public FP8ButtonBase
{
public:
FP8MomentaryButton (FP8Base& b, uint8_t id)
- : _base (b)
+ : FP8ButtonBase (b)
, _midi_id (id)
- , _pressed (false)
- , _active (false)
{}
~FP8MomentaryButton () {
@@ -391,6 +391,8 @@ public:
_hold_connection.disconnect ();
}
+ void ignore_release () { }
+
bool midi_event (bool a)
{
if (a == _pressed) {
@@ -423,12 +425,18 @@ public:
}
protected:
- FP8Base& _base;
+ void blink (bool onoff)
+ {
+ if (!blinking ()) {
+ _base.tx_midi3 (0x90, _midi_id, _active ? 0x7f : 0x00);
+ return;
+ }
+ _base.tx_midi3 (0x90, _midi_id, onoff ? 0x7f : 0x00);
+ }
+
uint8_t _midi_id; // MIDI-note
- bool _pressed;
bool _momentaty;
bool _was_active_on_press;
- bool _active;
private:
bool hold_timeout ()