From 169cf294c58979419a2e19e5a9c005d84ff0f021 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 17 Jun 2016 18:54:13 -0400 Subject: [PATCH] push2: expose page right/left buttons for scrolling; use right/left for banking; mute+solo debugging in place --- libs/surfaces/push2/buttons.cc | 32 ++++++++------- libs/surfaces/push2/push2.cc | 71 ++++++++++++++++++++++++++++------ libs/surfaces/push2/push2.h | 2 + 3 files changed, 80 insertions(+), 25 deletions(-) diff --git a/libs/surfaces/push2/buttons.cc b/libs/surfaces/push2/buttons.cc index 67778ffca4..360cf77fe8 100644 --- a/libs/surfaces/push2/buttons.cc +++ b/libs/surfaces/push2/buttons.cc @@ -198,9 +198,9 @@ Push2::build_maps () MAKE_WHITE_BUTTON (Session, 51); MAKE_WHITE_BUTTON (Layout, 31); MAKE_WHITE_BUTTON (OctaveUp, 55); - MAKE_WHITE_BUTTON (PageRight, 63); + MAKE_WHITE_BUTTON_PRESS (PageRight, 63, &Push2::button_page_right); MAKE_WHITE_BUTTON (OctaveDown, 54); - MAKE_WHITE_BUTTON (PageLeft, 62); + MAKE_WHITE_BUTTON_PRESS (PageLeft, 62, &Push2::button_page_left); MAKE_WHITE_BUTTON_PRESS_RELEASE_LONG (Shift, 49, &Push2::button_shift_press, &Push2::button_shift_release, &Push2::button_shift_long_press); MAKE_WHITE_BUTTON_PRESS_RELEASE_LONG (Select, 48, &Push2::button_select_press, &Push2::button_select_release, &Push2::button_select_long_press); } @@ -243,17 +243,29 @@ Push2::button_down () } void -Push2::button_right () +Push2::button_page_right () { ScrollTimeline (0.75); } void -Push2::button_left () +Push2::button_page_left () { ScrollTimeline (-0.75); } +void +Push2::button_right () +{ + switch_bank (max (0, bank_start + 8)); +} + +void +Push2::button_left () +{ + switch_bank (max (0, bank_start - 8)); +} + void Push2::button_repeat () { @@ -307,17 +319,12 @@ Push2::button_fixed_length () void Push2::button_browse () { - if (modifier_state & ModShift) { - access_action ("Editor/addExistingAudioFiles"); - } else { - switch_bank (max (0, bank_start - 8)); - } + access_action ("Editor/addExistingAudioFiles"); } void Push2::button_clip () { - switch_bank (max (0, bank_start + 8)); } void @@ -335,7 +342,7 @@ Push2::button_upper (uint32_t n) } else { boost::shared_ptr sc = stripable[n]->solo_control (); if (sc) { - sc->set_value (!sc->get_value(), PBD::Controllable::UseGroup); + sc->set_value (!sc->self_soloed(), PBD::Controllable::UseGroup); } } } @@ -350,11 +357,10 @@ Push2::button_lower (uint32_t n) if (modifier_state & ModSelect) { stripable[n]->presentation_info().set_selected (!stripable[n]->presentation_info().selected()); } else { - cerr << "select not set\n"; boost::shared_ptr mc = stripable[n]->mute_control (); if (mc) { - mc->set_value (!mc->get_value(), PBD::Controllable::UseGroup); + mc->set_value (!mc->muted_by_self(), PBD::Controllable::UseGroup); } } } diff --git a/libs/surfaces/push2/push2.cc b/libs/surfaces/push2/push2.cc index b67e7e7b00..16254f6215 100644 --- a/libs/surfaces/push2/push2.cc +++ b/libs/surfaces/push2/push2.cc @@ -194,7 +194,7 @@ Push2::init_buttons (bool startup) ButtonID buttons[] = { Mute, Solo, Master, Up, Right, Left, Down, Note, Session, Mix, AddTrack, Delete, Undo, Metronome, Shift, Select, Play, RecordEnable, Automate, Repeat, Note, Session, DoubleLoop, - Quantize, Duplicate, Browse, + Quantize, Duplicate, Browse, PageRight, PageLeft, }; for (size_t n = 0; n < sizeof (buttons) / sizeof (buttons[0]); ++n) { @@ -230,7 +230,7 @@ Push2::init_buttons (bool startup) ButtonID off_buttons[] = { TapTempo, Setup, User, Stop, Convert, New, FixedLength, Fwd32ndT, Fwd32nd, Fwd16thT, Fwd16th, Fwd8thT, Fwd8th, Fwd4trT, Fwd4tr, - Accent, Scale, Layout, Note, Session, OctaveUp, PageRight, OctaveDown, PageLeft, }; + Accent, Scale, Layout, Note, Session, OctaveUp, OctaveDown, }; for (size_t n = 0; n < sizeof (off_buttons) / sizeof (off_buttons[0]); ++n) { Button* b = id_button_map[off_buttons[n]]; @@ -1067,18 +1067,25 @@ Push2::solo_change (int n) return; } - boost::shared_ptr ac = stripable[n]->solo_control (); + boost::shared_ptr ac = stripable[n]->solo_control (); if (!ac) { return; } Button* b = id_button_map[bid]; - if (ac->get_value()) { - b->set_color (LED::Red); + + if (ac->soloed()) { + b->set_color (LED::Green); } else { b->set_color (LED::Black); } - b->set_state (LED::OneShot24th); + + if (ac->soloed_by_others_upstream() || ac->soloed_by_others_downstream()) { + b->set_state (LED::Blinking4th); + } else { + b->set_state (LED::OneShot24th); + } + write (b->state_msg()); } @@ -1087,6 +1094,12 @@ Push2::mute_change (int n) { ButtonID bid; + if (!stripable[n]) { + return; + } + + cerr << "Mute changed on " << n << ' ' << stripable[n]->name() << endl; + switch (n) { case 0: bid = Lower1; @@ -1116,19 +1129,53 @@ Push2::mute_change (int n) return; } - boost::shared_ptr ac = stripable[n]->mute_control (); - if (!ac) { + boost::shared_ptr mc = stripable[n]->mute_control (); + + if (!mc) { return; } Button* b = id_button_map[bid]; - if (ac->get_value ()) { - b->set_color (LED::Blue); + if (Config->get_show_solo_mutes() && !Config->get_solo_control_is_listen_control ()) { + + if (mc->muted_by_self ()) { + /* full mute */ + b->set_color (LED::Blue); + b->set_state (LED::OneShot24th); + cerr << "FULL MUTE1\n"; + } else if (mc->muted_by_others_soloing () || mc->muted_by_masters ()) { + /* this will reflect both solo mutes AND master mutes */ + b->set_color (LED::Blue); + b->set_state (LED::Blinking4th); + cerr << "OTHER MUTE1\n"; + } else { + /* no mute at all */ + b->set_color (LED::Black); + b->set_state (LED::OneShot24th); + cerr << "NO MUTE1\n"; + } + } else { - b->set_color (LED::Black); + + if (mc->muted_by_self()) { + /* full mute */ + b->set_color (LED::Blue); + b->set_state (LED::OneShot24th); + cerr << "FULL MUTE2\n"; + } else if (mc->muted_by_masters ()) { + /* this shows only master mutes, not mute-by-others-soloing */ + b->set_color (LED::Blue); + b->set_state (LED::Blinking4th); + cerr << "OTHER MUTE1\n"; + } else { + /* no mute at all */ + b->set_color (LED::Black); + b->set_state (LED::OneShot24th); + cerr << "NO MUTE2\n"; + } } - b->set_state (LED::OneShot24th); + write (b->state_msg()); } diff --git a/libs/surfaces/push2/push2.h b/libs/surfaces/push2/push2.h index 11599b7b74..b401d7e136 100644 --- a/libs/surfaces/push2/push2.h +++ b/libs/surfaces/push2/push2.h @@ -407,6 +407,8 @@ class Push2 : public ARDOUR::ControlProtocol void button_select_press (); void button_select_release (); void button_select_long_press (); + void button_page_left (); + void button_page_right (); void start_shift (); void end_shift ();