diff --git a/libs/surfaces/push2/buttons.cc b/libs/surfaces/push2/buttons.cc index 9db1808cd8..6c82945e80 100644 --- a/libs/surfaces/push2/buttons.cc +++ b/libs/surfaces/push2/buttons.cc @@ -803,15 +803,15 @@ Push2::button_mix_press () { /* toggle between global mix and track mix layouts */ if (_current_layout == _track_mix_layout) { - std::cerr << "go global mix\n"; set_current_layout (_mix_layout); + restore_pad_scale (); } else { if (ControlProtocol::first_selected_stripable()) { - std::cerr << "go track mix\n"; set_current_layout (_track_mix_layout); + restore_pad_scale (); } else { - std::cerr << "go global mix\n"; set_current_layout (_mix_layout); + restore_pad_scale (); } } } diff --git a/libs/surfaces/push2/push2.cc b/libs/surfaces/push2/push2.cc index 4fa953f6b2..d331b7d42b 100644 --- a/libs/surfaces/push2/push2.cc +++ b/libs/surfaces/push2/push2.cc @@ -821,11 +821,17 @@ Push2::handle_midi_note_on_message (MIDI::Parser& parser, MIDI::EventTwoBytes* e return; } + for (FNPadMap::iterator pi = pads_with_note.first; pi != pads_with_note.second; ++pi) { boost::shared_ptr pad = pi->second; - pad->set_color (_contrast_color); - pad->set_state (LED::OneShot24th); + if (pad->do_when_pressed == Pad::FlashOn) { + pad->set_color (_contrast_color); + pad->set_state (LED::OneShot24th); + } else if (pad->do_when_pressed == Pad::FlashOff) { + pad->set_color (LED::Black); + pad->set_state (LED::OneShot24th); + } write (pad->state_msg()); } } @@ -863,18 +869,13 @@ Push2::handle_midi_note_off_message (MIDI::Parser&, MIDI::EventTwoBytes* ev) return; } + for (FNPadMap::iterator pi = pads_with_note.first; pi != pads_with_note.second; ++pi) { boost::shared_ptr pad = pi->second; - if (pad->do_when_pressed == Pad::FlashOn) { - pad->set_color (LED::Black); - pad->set_state (LED::OneShot24th); - write (pad->state_msg()); - } else if (pad->do_when_pressed == Pad::FlashOff) { - pad->set_color (pad->perma_color); - pad->set_state (LED::OneShot24th); - write (pad->state_msg()); - } + pad->set_color (pad->perma_color); + pad->set_state (LED::NoTransition); + write (pad->state_msg()); } } @@ -1494,6 +1495,12 @@ Push2::set_pad_scale_in_key (const int scale_root, } } +void +Push2::restore_pad_scale () +{ + set_pad_scale (_scale_root, _root_octave, _mode, _note_grid_origin, _row_interval, _in_key); +} + void Push2::set_pad_scale_chromatic (const int scale_root, const int octave, @@ -1567,7 +1574,6 @@ Push2::set_pad_scale (const int scale_root, for (int col = 0; col < 8; ++col) { const int index = 36 + (row * 8) + col; const boost::shared_ptr& pad = _nn_pad_map[index]; - write (pad->state_msg ()); } } diff --git a/libs/surfaces/push2/push2.h b/libs/surfaces/push2/push2.h index 689baa9b48..ec5632129d 100644 --- a/libs/surfaces/push2/push2.h +++ b/libs/surfaces/push2/push2.h @@ -680,6 +680,8 @@ class Push2 : public ARDOUR::ControlProtocol int _octave_shift; bool _percussion; + void restore_pad_scale (); + void set_percussive_mode (bool); /* color map (device side) */