From b6c222555f33fdab72a0d823d77faa24246a83d6 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 20 Apr 2017 17:19:03 +0200 Subject: [PATCH] NO-OP: re-order code, add comments --- libs/surfaces/faderport8/actions.cc | 35 +++++++++++++++++------- libs/surfaces/faderport8/fp8_base.h | 2 +- libs/surfaces/faderport8/fp8_controls.cc | 1 + libs/surfaces/faderport8/fp8_strip.cc | 32 +++++++++++----------- 4 files changed, 43 insertions(+), 27 deletions(-) diff --git a/libs/surfaces/faderport8/actions.cc b/libs/surfaces/faderport8/actions.cc index 0c1112288b..fd75969211 100644 --- a/libs/surfaces/faderport8/actions.cc +++ b/libs/surfaces/faderport8/actions.cc @@ -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) { diff --git a/libs/surfaces/faderport8/fp8_base.h b/libs/surfaces/faderport8/fp8_base.h index c47f05b523..9dc658c290 100644 --- a/libs/surfaces/faderport8/fp8_base.h +++ b/libs/surfaces/faderport8/fp8_base.h @@ -31,7 +31,7 @@ namespace ArdourSurface { #define fp8_context() dynamic_cast(&_base) #define fp8_protocol() dynamic_cast(&_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: diff --git a/libs/surfaces/faderport8/fp8_controls.cc b/libs/surfaces/faderport8/fp8_controls.cc index 4626afd1f9..0920cc535b 100644 --- a/libs/surfaces/faderport8/fp8_controls.cc +++ b/libs/surfaces/faderport8/fp8_controls.cc @@ -276,6 +276,7 @@ FP8Controls::initialize () FP8ButtonInterface::force_change = false; } + void FP8Controls::all_lights_off () const { diff --git a/libs/surfaces/faderport8/fp8_strip.cc b/libs/surfaces/faderport8/fp8_strip.cc index 7c4d01165f..21c8affafb 100644 --- a/libs/surfaces/faderport8/fp8_strip.cc +++ b/libs/surfaces/faderport8/fp8_strip.cc @@ -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