13
0

push2: fix pad colors etc. after layout switches

This commit is contained in:
Paul Davis 2022-08-30 21:37:16 -06:00
parent 748fbf6fb1
commit 678ed40bd3
3 changed files with 23 additions and 15 deletions

View File

@ -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 ();
}
}
}

View File

@ -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> pad = pi->second;
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,19 +869,14 @@ 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> 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);
pad->set_state (LED::NoTransition);
write (pad->state_msg());
}
}
}
void
@ -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>& pad = _nn_pad_map[index];
write (pad->state_msg ());
}
}

View File

@ -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) */