From 601604972c680ff8e04c991aa2c73cd4de689a1f Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 19 Jul 2017 01:52:14 +0200 Subject: FP8: Fix Mixbus solo-state and indicate implicit solo (blink) --- libs/surfaces/faderport8/actions.cc | 9 ++++++--- libs/surfaces/faderport8/callbacks.cc | 3 +++ libs/surfaces/faderport8/fp8_button.h | 26 +++++++++++++++++--------- libs/surfaces/faderport8/fp8_strip.cc | 11 ++++++++++- 4 files changed, 36 insertions(+), 13 deletions(-) (limited to 'libs/surfaces') diff --git a/libs/surfaces/faderport8/actions.cc b/libs/surfaces/faderport8/actions.cc index 21ed2998c3..8be8272a26 100644 --- a/libs/surfaces/faderport8/actions.cc +++ b/libs/surfaces/faderport8/actions.cc @@ -307,6 +307,9 @@ void FaderPort8::button_solo_clear () { bool soloing = session->soloing() || session->listening(); +#ifdef MIXBUS + soloing |= session->mixbus_soloed(); +#endif if (soloing) { StripableList all; session->get_stripables (all); @@ -314,9 +317,9 @@ FaderPort8::button_solo_clear () if ((*i)->is_master() || (*i)->is_auditioner() || (*i)->is_monitor()) { continue; } - boost::shared_ptr ac = (*i)->solo_control(); - if (ac && ac->get_value () > 0) { - _solo_state.push_back (boost::weak_ptr(ac)); + boost::shared_ptr sc = (*i)->solo_control(); + if (sc && sc->self_soloed ()) { + _solo_state.push_back (boost::weak_ptr(sc)); } } AccessAction ("Main", "cancel-solo"); diff --git a/libs/surfaces/faderport8/callbacks.cc b/libs/surfaces/faderport8/callbacks.cc index d6f12150b4..f9a7d4976a 100644 --- a/libs/surfaces/faderport8/callbacks.cc +++ b/libs/surfaces/faderport8/callbacks.cc @@ -187,6 +187,9 @@ void FaderPort8::notify_solo_changed () { bool soloing = session->soloing() || session->listening(); +#ifdef MIXBUS + soloing |= session->mixbus_soloed(); +#endif _ctrls.button (FP8Controls::BtnSoloClear).set_active (soloing); #ifdef FP8_MUTESOLO_UNDO if (soloing) { 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 () diff --git a/libs/surfaces/faderport8/fp8_strip.cc b/libs/surfaces/faderport8/fp8_strip.cc index 39aeb4b2f2..f1d6176829 100644 --- a/libs/surfaces/faderport8/fp8_strip.cc +++ b/libs/surfaces/faderport8/fp8_strip.cc @@ -91,6 +91,7 @@ FP8Strip::initialize () * ie from FaderPort8::connected() */ _solo.set_active (false); + _solo.set_blinking (false); _mute.set_active (false); /* reset momentary button state */ @@ -414,8 +415,16 @@ void FP8Strip::notify_solo_changed () { if (_solo_ctrl) { - _solo.set_active (_solo_ctrl->get_value () > 0); + boost::shared_ptr sc = boost::dynamic_pointer_cast (_solo_ctrl); + if (sc) { + _solo.set_blinking (sc->soloed_by_others () && !sc->self_soloed ()); + _solo.set_active (sc->self_soloed ()); + } else { + _solo.set_blinking (false); + _solo.set_active (_solo_ctrl->get_value () > 0); + } } else { + _solo.set_blinking (false); _solo.set_active (false); } } -- cgit v1.2.3