aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2023-05-30 14:00:23 +0200
committerBad Diode <bd@badd10de.dev>2023-05-30 14:00:23 +0200
commitb4593763ec78f14b9c6fb309f595740264969806 (patch)
tree1316d5ac80b7cfa167bbfc221d4a5558ca86769a
parentaf91b10094ba70651c27d279f77af13a433600f2 (diff)
downloadstepper-b4593763ec78f14b9c6fb309f595740264969806.tar.gz
stepper-b4593763ec78f14b9c6fb309f595740264969806.zip
Fix navigation on right column
-rw-r--r--src/globals.c4
-rw-r--r--src/sequencer.c55
2 files changed, 37 insertions, 22 deletions
diff --git a/src/globals.c b/src/globals.c
index cbf0c63..f62962a 100644
--- a/src/globals.c
+++ b/src/globals.c
@@ -82,8 +82,8 @@ bool clear_screen = true;
82 82
83enum RIGHT_COL_LOC { 83enum RIGHT_COL_LOC {
84 R_COL_BPM = 0, 84 R_COL_BPM = 0,
85 R_COL_STOP = 1, 85 R_COL_PLAY = 1,
86 R_COL_PLAY = 2, 86 R_COL_STOP = 2,
87 R_COL_BANK_D = 3, 87 R_COL_BANK_D = 3,
88 R_COL_BANK_C = 4, 88 R_COL_BANK_C = 4,
89 R_COL_BANK_B = 5, 89 R_COL_BANK_B = 5,
diff --git a/src/sequencer.c b/src/sequencer.c
index 115d848..b2a8468 100644
--- a/src/sequencer.c
+++ b/src/sequencer.c
@@ -367,31 +367,46 @@ select_bank(int i) {
367void 367void
368handle_right_col_selection(void) { 368handle_right_col_selection(void) {
369 if (key_tap(KEY_LEFT)) { 369 if (key_tap(KEY_LEFT)) {
370 input_handler = handle_trigger_selection; 370 if (right_col_selection_loc == R_COL_STOP) {
371 switch (right_col_selection_loc) { 371 right_col_selection_loc = R_COL_PLAY;
372 case R_COL_BPM: { trig_selection_loc = 15; } break; 372 } else {
373 default: { trig_selection_loc = 7; } break; 373 input_handler = handle_trigger_selection;
374 switch (right_col_selection_loc) {
375 case R_COL_BPM: { trig_selection_loc = 15; } break;
376 default: { trig_selection_loc = 7; } break;
377 }
378 redraw_params = true;
374 } 379 }
375 redraw_params = true;
376 } else if (key_tap(KEY_RIGHT)) { 380 } else if (key_tap(KEY_RIGHT)) {
377 input_handler = handle_pattern_selection; 381 if (right_col_selection_loc == R_COL_PLAY) {
378 switch (right_col_selection_loc) { 382 right_col_selection_loc = R_COL_STOP;
379 case R_COL_BANK_A: { pattern_selection_loc = 0; } break; 383 } else {
380 case R_COL_BANK_B: { pattern_selection_loc = 1; } break; 384 input_handler = handle_pattern_selection;
381 case R_COL_BANK_C: { pattern_selection_loc = 2; } break; 385 switch (right_col_selection_loc) {
382 case R_COL_BANK_D: { pattern_selection_loc = 3; } break; 386 case R_COL_BANK_A: { pattern_selection_loc = 0; } break;
383 case R_COL_PLAY: { pattern_selection_loc = 4; } break; 387 case R_COL_BANK_B: { pattern_selection_loc = 1; } break;
384 case R_COL_STOP: { pattern_selection_loc = 5; } break; 388 case R_COL_BANK_C: { pattern_selection_loc = 2; } break;
385 default: { pattern_selection_loc = 6; } break; 389 case R_COL_BANK_D: { pattern_selection_loc = 3; } break;
390 case R_COL_STOP: { pattern_selection_loc = 5; } break;
391 default: { pattern_selection_loc = 6; } break;
392 }
393 redraw_trigs = true;
386 } 394 }
387 redraw_trigs = true;
388 } else if (key_tap(KEY_UP)) { 395 } else if (key_tap(KEY_UP)) {
389 if (right_col_selection_loc < R_COL_BANK_A) { 396 switch (right_col_selection_loc) {
390 right_col_selection_loc++; 397 case R_COL_PLAY:
398 case R_COL_STOP: { right_col_selection_loc = R_COL_BANK_D; } break;
399 case R_COL_BPM: { right_col_selection_loc = R_COL_PLAY; } break;
400 case R_COL_BANK_A: { right_col_selection_loc = R_COL_BPM; } break;
401 default: { right_col_selection_loc++; } break;
391 } 402 }
392 } else if (key_tap(KEY_DOWN)) { 403 } else if (key_tap(KEY_DOWN)) {
393 if (right_col_selection_loc > R_COL_BPM) { 404 switch (right_col_selection_loc) {
394 right_col_selection_loc--; 405 case R_COL_PLAY:
406 case R_COL_STOP: { right_col_selection_loc = R_COL_BPM; } break;
407 case R_COL_BPM: { right_col_selection_loc = R_COL_BANK_A; } break;
408 case R_COL_BANK_D: { right_col_selection_loc = R_COL_PLAY; } break;
409 default: { right_col_selection_loc--; } break;
395 } 410 }
396 } else if (key_tap(KEY_L)) { 411 } else if (key_tap(KEY_L)) {
397 switch (right_col_selection_loc) { 412 switch (right_col_selection_loc) {
@@ -938,7 +953,7 @@ handle_trigger_selection(void) {
938 trig_selection_loc = MIN(trig_selection_loc + 1, 15); 953 trig_selection_loc = MIN(trig_selection_loc + 1, 15);
939 } else if (trig_selection_loc == 7) { 954 } else if (trig_selection_loc == 7) {
940 input_handler = handle_right_col_selection; 955 input_handler = handle_right_col_selection;
941 right_col_selection_loc = R_COL_STOP; 956 right_col_selection_loc = R_COL_PLAY;
942 } else if (trig_selection_loc == 15) { 957 } else if (trig_selection_loc == 15) {
943 right_col_selection_loc = R_COL_BPM; 958 right_col_selection_loc = R_COL_BPM;
944 input_handler = handle_right_col_selection; 959 input_handler = handle_right_col_selection;