push2: make octave buttons actually work, with shift-press to reset to zero

This commit is contained in:
Paul Davis 2016-07-10 11:29:57 -04:00
parent 6b080bf6ec
commit c4602603b4
2 changed files with 11 additions and 3 deletions

View file

@ -503,20 +503,28 @@ Push2::start_press_timeout (Button& button, ButtonID id)
void void
Push2::button_octave_down () Push2::button_octave_down ()
{ {
if (_modifier_state & ModShift) {
octave_shift = 0;
return;
}
int os = (max (-4, octave_shift - 1)); int os = (max (-4, octave_shift - 1));
if (os != octave_shift) { if (os != octave_shift) {
octave_shift = os; octave_shift = os;
build_pad_table ();
} }
} }
void void
Push2::button_octave_up () Push2::button_octave_up ()
{ {
if (_modifier_state & ModShift) {
octave_shift = 0;
return;
}
int os = (min (4, octave_shift + 1)); int os = (min (4, octave_shift + 1));
if (os != octave_shift) { if (os != octave_shift) {
octave_shift = os; octave_shift = os;
build_pad_table ();
} }
} }

View file

@ -1256,7 +1256,7 @@ Push2::pad_filter (MidiBuffer& in, MidiBuffer& out) const
Pad const * pad = nni->second; Pad const * pad = nni->second;
/* shift for output to the shadow port */ /* shift for output to the shadow port */
if (pad->filtered >= 0) { if (pad->filtered >= 0) {
(*ev).set_note (pad->filtered); (*ev).set_note (pad->filtered + (octave_shift*12));
out.push_back (*ev); out.push_back (*ev);
/* shift back so that the pads light correctly */ /* shift back so that the pads light correctly */
(*ev).set_note (n); (*ev).set_note (n);