NO-OP: re-order code, add comments
authorRobin Gareus <robin@gareus.org>
Thu, 20 Apr 2017 15:19:03 +0000 (17:19 +0200)
committerRobin Gareus <robin@gareus.org>
Thu, 20 Apr 2017 15:19:03 +0000 (17:19 +0200)
libs/surfaces/faderport8/actions.cc
libs/surfaces/faderport8/fp8_base.h
libs/surfaces/faderport8/fp8_controls.cc
libs/surfaces/faderport8/fp8_strip.cc

index 0c1112288b21cc62c66039a6bdfaef15671a9d18..fd75969211cd6dd7c0d0b63c198c7df4f953667b 100644 (file)
@@ -48,6 +48,11 @@ using namespace ArdourSurface::FP8Types;
        _ctrls.button (ID).pressed.connect_same_thread (button_connections, boost::bind (&FaderPort8::button_user, this, true, ID)); \
 _ctrls.button (ID).released.connect_same_thread (button_connections, boost::bind (&FaderPort8::button_user, this, false, ID));
 
+
+/* Bind button signals (press, release) to callback methods
+ * (called once after constructing buttons).
+ * Bound actions are handled the the ctrl-surface thread.
+ */
 void
 FaderPort8::setup_actions ()
 {
@@ -101,6 +106,10 @@ FaderPort8::setup_actions ()
        }
 }
 
+/* ****************************************************************************
+ * Direct control callback Actions
+ */
+
 void
 FaderPort8::button_play ()
 {
@@ -254,28 +263,34 @@ FaderPort8::button_mute_clear ()
        session->set_controls (cl, 0.0, PBD::Controllable::UseGroup);
 }
 
-void
-FaderPort8::button_arm (bool press)
-{
-       FaderMode fadermode = _ctrls.fader_mode ();
-       if (fadermode == ModeTrack || fadermode == ModePan) {
-               _ctrls.button (FP8Controls::BtnArm).set_active (press);
-               ARMButtonChange (press);
-       }
-}
-
 void
 FaderPort8::button_arm_all ()
 {
        BasicUI::all_tracks_rec_in ();
 }
 
+/* access generic action */
 void
 FaderPort8::button_action (const std::string& group, const std::string& item)
 {
        AccessAction (group, item);
 }
 
+/* ****************************************************************************
+ * Mode specific and internal callbacks
+ */
+
+/* handle "ARM" press -- act like shift, change "Select" button mode */
+void
+FaderPort8::button_arm (bool press)
+{
+       FaderMode fadermode = _ctrls.fader_mode ();
+       if (fadermode == ModeTrack || fadermode == ModePan) {
+               _ctrls.button (FP8Controls::BtnArm).set_active (press);
+               ARMButtonChange (press); /* EMIT SIGNAL */
+       }
+}
+
 void
 FaderPort8::button_prev_next (bool next)
 {
index c47f05b5232b02af75888fa0cd82b345c476cac3..9dc658c290be5e44436e70cc69fbdd4fb16f5d16 100644 (file)
@@ -31,7 +31,7 @@ namespace ArdourSurface {
 #define fp8_context() dynamic_cast<BaseUI*>(&_base)
 #define fp8_protocol() dynamic_cast<ControlProtocol*>(&_base)
 
-/** Virtual abstracte base of the FaderPort8 control surface
+/** Virtual abstract base of the FaderPort8 control surface
  *
  * This is passed as handle to all elements (buttons, lights,..)
  * to inteface common functionality for the current instance:
index 4626afd1f99ed1a4ddbd09905ca3b87cd346df09..0920cc535b9d3b0296109bc6f55a08c5b705c5e4 100644 (file)
@@ -276,6 +276,7 @@ FP8Controls::initialize ()
 
        FP8ButtonInterface::force_change = false;
 }
+
 void
 FP8Controls::all_lights_off () const
 {
index 7c4d01165f1894d7719cabef910ced4c9ff1f8c7..21c8affafbca68a2a732ed4b6e4a083376db2c39 100644 (file)
@@ -315,32 +315,35 @@ FP8Strip::group_mode () const
 void
 FP8Strip::set_mute (bool on)
 {
-       if (_mute_ctrl) {
-               if (_mute_ctrl->automation_state() == Touch && !_mute_ctrl->touching ()) {
-                       _mute_ctrl->start_touch (_mute_ctrl->session().transport_frame());
-               }
-               _mute_ctrl->set_value (on ? 1.0 : 0.0, group_mode ());
+       if (!_mute_ctrl) {
+               return;
        }
+       if (_mute_ctrl->automation_state() == Touch && !_mute_ctrl->touching ()) {
+               _mute_ctrl->start_touch (_mute_ctrl->session().transport_frame());
+       }
+       _mute_ctrl->set_value (on ? 1.0 : 0.0, group_mode ());
 }
 
 void
 FP8Strip::set_solo (bool on)
 {
-       if (_solo_ctrl) {
-               if (_solo_ctrl->automation_state() == Touch && !_solo_ctrl->touching ()) {
-                       _solo_ctrl->start_touch (_solo_ctrl->session().transport_frame());
-               }
-               _solo_ctrl->set_value (on ? 1.0 : 0.0, group_mode ());
+       if (!_solo_ctrl) {
+               return;
+       }
+       if (_solo_ctrl->automation_state() == Touch && !_solo_ctrl->touching ()) {
+               _solo_ctrl->start_touch (_solo_ctrl->session().transport_frame());
        }
+       _solo_ctrl->set_value (on ? 1.0 : 0.0, group_mode ());
 }
 
 void
 FP8Strip::set_recarm ()
 {
-       if (_rec_ctrl) {
-               const bool on = !recarm_button ().is_active();
-               _rec_ctrl->set_value (on ? 1.0 : 0.0, group_mode ());
+       if (!_rec_ctrl) {
+               return;
        }
+       const bool on = !recarm_button ().is_active();
+       _rec_ctrl->set_value (on ? 1.0 : 0.0, group_mode ());
 }
 
 void
@@ -431,8 +434,6 @@ FP8Strip::notify_x_select_changed ()
                select_button ().set_active (_x_select_ctrl->get_value() > 0.);
                select_button ().set_color (0xffff00ff);
                select_button ().set_blinking (false);
-       } else {
-               ; // leave alone.
        }
 }
 
@@ -562,7 +563,6 @@ FP8Strip::set_strip_mode (uint8_t strip_mode, bool clear)
        }
        _strip_mode = strip_mode;
        _base.tx_sysex (3, 0x13, _id, (_strip_mode & 0x07) | (clear ? 0x10 : 0));
-       //_base.tx_midi3 (0xb0, 0x38 + _id, _bar_mode);
 }
 
 void