Skip to content

Commit f9452ec

Browse files
committed
Fix missing shift even occured
1 parent 31a9e49 commit f9452ec

2 files changed

Lines changed: 14 additions & 17 deletions

File tree

Applications/Note/NoteControlBar.cpp

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,6 @@ void NoteControlBar::ShiftEventOccured() {
4444
}
4545
}
4646

47-
void NoteControlBar::ShiftClear() {
48-
shift[0] = 0;
49-
shift[1] = 0;
50-
}
51-
52-
5347
bool NoteControlBar::KeyEvent(Point xy, KeyInfo* keyInfo) {
5448
if(xy.y < CTL_BAR_Y - 1)
5549
{
@@ -71,6 +65,7 @@ bool NoteControlBar::KeyEvent(Point xy, KeyInfo* keyInfo) {
7165
if(keyInfo->State() == PRESSED) {
7266
if(ShiftActive()) {
7367
MatrixOS::MIDI::Send(MidiPacket::Stop(), MIDI_PORT_ALL);
68+
ShiftEventOccured();
7469
}
7570
else {
7671
pitch_down = MatrixOS::SYS::Millis();
@@ -100,6 +95,7 @@ bool NoteControlBar::KeyEvent(Point xy, KeyInfo* keyInfo) {
10095
if(keyInfo->State() == PRESSED) {
10196
if(ShiftActive()) {
10297
MatrixOS::MIDI::Send(MidiPacket::Start(), MIDI_PORT_ALL);
98+
ShiftEventOccured();
10399
}
104100
else {
105101
pitch_up = MatrixOS::SYS::Millis();
@@ -128,6 +124,7 @@ bool NoteControlBar::KeyEvent(Point xy, KeyInfo* keyInfo) {
128124
if(keyInfo->State() == PRESSED) {
129125
if(ShiftActive()) {
130126
notePad[0]->rt->noteLatch.SetToggleMode(!notePad[0]->rt->noteLatch.IsToggleMode());
127+
ShiftEventOccured();
131128
}
132129
else
133130
{
@@ -146,6 +143,7 @@ bool NoteControlBar::KeyEvent(Point xy, KeyInfo* keyInfo) {
146143
mode = CHORD_MODE;
147144
}
148145
chordToggleMode = !chordToggleMode;
146+
ShiftEventOccured();
149147
}
150148
else if(mode == CHORD_MODE) {
151149
// Already on: turn off
@@ -163,8 +161,8 @@ bool NoteControlBar::KeyEvent(Point xy, KeyInfo* keyInfo) {
163161
else if(xy == Point(4, CTL_BAR_Y - 1)) {
164162
if(keyInfo->State() == PRESSED) {
165163
if(ShiftActive()) {
166-
ShiftClear();
167164
note->ArpConfigMenu();
165+
ShiftEventOccured();
168166
} else if(mode == ARP_MODE) {
169167
mode = OFF_MODE;
170168
} else {
@@ -178,9 +176,9 @@ bool NoteControlBar::KeyEvent(Point xy, KeyInfo* keyInfo) {
178176
else if(xy == Point(5, CTL_BAR_Y - 1)) {
179177
if(keyInfo->State() == PRESSED) {
180178
if(ShiftActive()) {
181-
ShiftClear();
182179
note->ScaleSelector();
183180
notePad[0]->GenerateKeymap();
181+
ShiftEventOccured();
184182
} else if(mode == KEY_MODE) {
185183
mode = OFF_MODE;
186184
} else {
@@ -193,13 +191,13 @@ bool NoteControlBar::KeyEvent(Point xy, KeyInfo* keyInfo) {
193191
// Octave Down
194192
else if(xy == Point(6, CTL_BAR_Y - 1)) {
195193
if(keyInfo->State() == PRESSED) {
196-
if(!ShiftActive()) {
197-
shift[0] = MatrixOS::SYS::Millis();
198-
}
199-
else {
194+
if(ShiftActive()) {
200195
SwapActiveConfig();
201196
ShiftEventOccured();
202197
}
198+
else {
199+
shift[0] = MatrixOS::SYS::Millis();
200+
}
203201
}
204202
else if(keyInfo->State() == RELEASED) {
205203
if((MatrixOS::SYS::Millis() - shift[0] < hold_threshold) && shift_event[0] == false) {
@@ -216,13 +214,13 @@ bool NoteControlBar::KeyEvent(Point xy, KeyInfo* keyInfo) {
216214
// Octave Up
217215
else if(xy == Point(7, CTL_BAR_Y - 1)) {
218216
if(keyInfo->State() == PRESSED) {
219-
if(!ShiftActive()) {
220-
shift[1] = MatrixOS::SYS::Millis();
221-
}
222-
else {
217+
if(ShiftActive()) {
223218
SwapActiveConfig();
224219
ShiftEventOccured();
225220
}
221+
else {
222+
shift[1] = MatrixOS::SYS::Millis();
223+
}
226224
}
227225
else if(keyInfo->State() == RELEASED) {
228226
if((MatrixOS::SYS::Millis() - shift[1] < hold_threshold) && shift_event[1] == false) {

Applications/Note/NoteControlBar.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ class NoteControlBar : public UIComponent {
3232
void SwapActiveConfig();
3333
bool ShiftActive();
3434
void ShiftEventOccured();
35-
void ShiftClear();
3635
Color GetOctavePlusColor();
3736
Color GetOctaveMinusColor();
3837

0 commit comments

Comments
 (0)