From d1c68125b6825f0327a4089aa8ddca5105e78ec1 Mon Sep 17 00:00:00 2001 From: Bad Diode Date: Thu, 13 Jul 2023 10:21:12 +0200 Subject: Add initial pattern chain UI --- src/sequencer.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'src/sequencer.c') 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) { default: { right_col_selection_loc = R_COL_BPM; } break; } } + if (key_tap(KEY_R)) { + // Find next empty slot. + s16 slot = -1; + for (size_t i = 0; i < 16; i++) { + if (chain.active[i] == 0) { + slot = i; + break; + } + } + if (slot > -1) { + chain.chain[slot] = pattern_selection_loc; + chain.active[slot] = 1; + chain.len++; // TODO: remove + } + } + if (key_tap(KEY_L)) { + // Find last active slot. + s16 slot = -1; + for (size_t i = 0; i < 16; i++) { + if (chain.active[15 - i] == 1) { + slot = 15 - i; + break; + } + } + if (slot > -1) { + chain.active[slot] = 0; + chain.len--; // TODO: remove + } + } } bool -- cgit v1.2.1