From b83958d07ec0e4dcc185f40928a84d1bcdd48675 Mon Sep 17 00:00:00 2001 From: Bad Diode Date: Mon, 24 Apr 2023 12:42:16 +0200 Subject: Add transposition of channel notes with SEL + L/R --- src/sequencer.c | 56 +++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 39 insertions(+), 17 deletions(-) (limited to 'src/sequencer.c') diff --git a/src/sequencer.c b/src/sequencer.c index d3f2483..8f2b183 100644 --- a/src/sequencer.c +++ b/src/sequencer.c @@ -185,32 +185,63 @@ get_current_trig(void) { void handle_channel_selection(void) { + Pattern *pat = &patterns[pattern_selection_loc]; if (key_tap(KEY_B)) { if (key_hold(KEY_SELECT)) { clipboard_copy(); } else { switch (channel_selection_loc) { case 0: { - patterns[pattern_selection_loc].ch1.active ^= 1; + pat->ch1.active ^= 1; } break; case 1: { - patterns[pattern_selection_loc].ch2.active ^= 1; + pat->ch2.active ^= 1; } break; case 2: { - patterns[pattern_selection_loc].ch3.active ^= 1; + pat->ch3.active ^= 1; } break; case 3: { - patterns[pattern_selection_loc].ch4.active ^= 1; + pat->ch4.active ^= 1; } break; } redraw_channels = true; } - } else { - if (key_tap(KEY_A)) { - if (key_hold(KEY_SELECT)) { - clipboard_paste(); + } else if (key_tap(KEY_A)) { + if (key_hold(KEY_SELECT)) { + clipboard_paste(); + } + } else if (key_tap(KEY_L)) { + s32 inc = -1; + if (key_hold(KEY_SELECT)) { + inc = -12; + } + for (size_t i = 0; i < 16; i++) { + TriggerNote *trig; + switch (channel_selection_loc) { + case 0: { trig = &pat->ch1.notes[i]; } break; + case 1: { trig = &pat->ch2.notes[i]; } break; + case 2: { trig = &pat->ch3.notes[i]; } break; + case 3: { trig = &pat->ch4.notes[i]; } break; } + trig->note = MAX((s32)trig->note + inc, (s32)NOTE_C_2); + } + redraw_trigs = true; + } else if (key_tap(KEY_R)) { + s32 inc = 1; + if (key_hold(KEY_SELECT)) { + inc = 12; + } + for (size_t i = 0; i < 16; i++) { + TriggerNote *trig; + switch (channel_selection_loc) { + case 0: { trig = &pat->ch1.notes[i]; } break; + case 1: { trig = &pat->ch2.notes[i]; } break; + case 2: { trig = &pat->ch3.notes[i]; } break; + case 3: { trig = &pat->ch4.notes[i]; } break; + } + trig->note = MIN((s32)trig->note + inc, (s32)NOTE_C_8 - 1); } + redraw_trigs = true; } if (key_tap(KEY_RIGHT)) { trig_selection_loc = 0; @@ -887,15 +918,6 @@ handle_sequencer_input(void) { clipboard_copy(); } input_handler(); - // // if (input_handler == handle_right_col_selection) { - // // input_handler(); - // // } - // // // Clipboard combo. - // // else if (key_tap(KEY_A)) { - // // clipboard_paste(); - // // } else if (key_tap(KEY_B)){ - // // clipboard_copy(); - // // } } else { input_handler(); } -- cgit v1.2.1