From 183c43fe2d85be24e43f09e62c07911e82935b1d Mon Sep 17 00:00:00 2001 From: Bad Diode Date: Mon, 24 Apr 2023 15:24:41 +0200 Subject: Add initial copy-paste of trig to ch --- src/clipboard.c | 34 ++++++++++++++++++++++++++++++++++ src/main.c | 8 ++++++-- src/sequencer.c | 4 +++- 3 files changed, 43 insertions(+), 3 deletions(-) diff --git a/src/clipboard.c b/src/clipboard.c index d802645..97e083f 100644 --- a/src/clipboard.c +++ b/src/clipboard.c @@ -279,6 +279,40 @@ clipboard_paste(void) { } draw_channels(); draw_triggers(); + } else if (input_handler == handle_channel_selection) { + if (clipboard.type == CLIP_TRIG || + clipboard.type == CLIP_PARAM_CH1 || + clipboard.type == CLIP_PARAM_CH2 || + clipboard.type == CLIP_PARAM_CH3 || + clipboard.type == CLIP_PARAM_CH4) { + if (clipboard.src_chan == channel_selection_loc) { + switch (channel_selection_loc) { + case 0: { + for (size_t i = 0; i < 17; i++) { + pat_dst->ch1.params[i] = pat_src->ch1.params[clipboard.src_trig]; + } + } break; + case 1: { + for (size_t i = 0; i < 17; i++) { + pat_dst->ch2.params[i] = pat_src->ch2.params[clipboard.src_trig]; + } + } break; + case 2: { + for (size_t i = 0; i < 17; i++) { + pat_dst->ch3.params[i] = pat_src->ch3.params[clipboard.src_trig]; + } + } break; + case 3: { + for (size_t i = 0; i < 17; i++) { + pat_dst->ch4.params[i] = pat_src->ch4.params[clipboard.src_trig]; + } + } break; + } + } + // TODO: copy params to position 16 (per-channel) if it matches the + // channel type. + // TODO: update all parameters in the rest of the triggers. + } } else if (input_handler == handle_pattern_selection && clipboard.type == CLIP_PATTERN) { // Copy an entire pattern. if (pattern_selection_loc != clipboard.src_pat) { diff --git a/src/main.c b/src/main.c index d4e6dbb..ea10fdb 100644 --- a/src/main.c +++ b/src/main.c @@ -23,7 +23,11 @@ WITH REGARD TO THIS SOFTWARE. // - Theming support, with a number of pre-configured themes and custom colors. // // Quality of life improvements. -// - Per channel sound adjustments that modify the sound in all trigs. +// + Per channel sound adjustments that modify the sound in all trigs. +// + Basic support. +// - Allow pasting parameters if they have been copied. +// - Draw the global params in grey if they haven't been adjusted or aren't +// currently selected. // + Per-octave note adjustment with Select + L/R on a trig. // + Transpose channel with SEL + L/R on channel select. // - Pattern chaining for more than 1 queue and/or song mode. @@ -42,7 +46,7 @@ WITH REGARD TO THIS SOFTWARE. #include "renderer_m0.c" #include "sequencer.c" -#define PROF_ENABLE 0 +#define PROF_ENABLE 1 #include "profiling.c" void diff --git a/src/sequencer.c b/src/sequencer.c index b5339fa..179e72f 100644 --- a/src/sequencer.c +++ b/src/sequencer.c @@ -216,8 +216,8 @@ handle_channel_selection(void) { case 2: { input_handler = handle_param_selection_ch3; } break; case 3: { input_handler = handle_param_selection_ch4; } break; } - redraw_params = true; } + redraw_params = true; } else if (key_tap(KEY_L)) { s32 inc = -1; if (key_hold(KEY_SELECT)) { @@ -267,6 +267,7 @@ handle_channel_selection(void) { } else { channel_selection_loc = MAX(channel_selection_loc - 1, 0); } + param_selection_loc = 0; redraw_trigs = true; redraw_params = true; } else if (key_tap(KEY_DOWN)) { @@ -275,6 +276,7 @@ handle_channel_selection(void) { } else { channel_selection_loc = MIN(channel_selection_loc + 1, SEQ_N_CHANNELS); } + param_selection_loc = 0; redraw_trigs = true; redraw_params = true; } -- cgit v1.2.1