diff options
author | Bad Diode <bd@badd10de.dev> | 2023-07-13 10:21:12 +0200 |
---|---|---|
committer | Bad Diode <bd@badd10de.dev> | 2023-07-13 10:21:12 +0200 |
commit | d1c68125b6825f0327a4089aa8ddca5105e78ec1 (patch) | |
tree | ed0b902221c42a534b594be9891f3c5688cabb4e /src/sequencer.c | |
parent | 8fa42f9f9107f460b49fa7ab171529942e66e7ea (diff) | |
download | stepper-d1c68125b6825f0327a4089aa8ddca5105e78ec1.tar.gz stepper-d1c68125b6825f0327a4089aa8ddca5105e78ec1.zip |
Add initial pattern chain UI
Diffstat (limited to 'src/sequencer.c')
-rw-r--r-- | src/sequencer.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/sequencer.c b/src/sequencer.c index 5b70bb2..44ff90e 100644 --- a/src/sequencer.c +++ b/src/sequencer.c | |||
@@ -520,6 +520,35 @@ handle_pattern_selection(void) { | |||
520 | default: { right_col_selection_loc = R_COL_BPM; } break; | 520 | default: { right_col_selection_loc = R_COL_BPM; } break; |
521 | } | 521 | } |
522 | } | 522 | } |
523 | if (key_tap(KEY_R)) { | ||
524 | // Find next empty slot. | ||
525 | s16 slot = -1; | ||
526 | for (size_t i = 0; i < 16; i++) { | ||
527 | if (chain.active[i] == 0) { | ||
528 | slot = i; | ||
529 | break; | ||
530 | } | ||
531 | } | ||
532 | if (slot > -1) { | ||
533 | chain.chain[slot] = pattern_selection_loc; | ||
534 | chain.active[slot] = 1; | ||
535 | chain.len++; // TODO: remove | ||
536 | } | ||
537 | } | ||
538 | if (key_tap(KEY_L)) { | ||
539 | // Find last active slot. | ||
540 | s16 slot = -1; | ||
541 | for (size_t i = 0; i < 16; i++) { | ||
542 | if (chain.active[15 - i] == 1) { | ||
543 | slot = 15 - i; | ||
544 | break; | ||
545 | } | ||
546 | } | ||
547 | if (slot > -1) { | ||
548 | chain.active[slot] = 0; | ||
549 | chain.len--; // TODO: remove | ||
550 | } | ||
551 | } | ||
523 | } | 552 | } |
524 | 553 | ||
525 | bool | 554 | bool |